-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a basic test for shortcode transformation #7823
Conversation
isValid: true, | ||
name: 'core/shortcode', | ||
uid: transformed[ 1 ].uid, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use createBlock
instead of crafting the final object, so we're only testing the converter (and not tying any future structure changes to this test).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, updated in b90feeb
expect( transformed[ 1 ] ).toEqual( expectedBlock ); | ||
expect( transformed[ 2 ] ).toBe( ` | ||
|
||
<p>Bar</p>` ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but I'd .trim()
the values transformed[ 0 ]
and transformed[ 2 ]
and test against just <p>…</p>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to use .trim()
, as I think whitespace should be a part of the assertion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition.
Previously #7689
See #7030, #4456