Skip to content
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

Merged
merged 2 commits into from
Jul 9, 2018

Conversation

danielbachhuber
Copy link
Member

@danielbachhuber danielbachhuber commented Jul 9, 2018

Previously #7689

See #7030, #4456

@danielbachhuber danielbachhuber added this to the 3.3 milestone Jul 9, 2018
@danielbachhuber danielbachhuber requested a review from a team July 9, 2018 13:19
@danielbachhuber danielbachhuber added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Feature] Paste [Feature] Shortcodes Related to shortcode functionality labels Jul 9, 2018
isValid: true,
name: 'core/shortcode',
uid: transformed[ 1 ].uid,
};
Copy link
Contributor

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).

Copy link
Member Author

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>` );
Copy link
Contributor

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>.

Copy link
Member Author

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.

@danielbachhuber danielbachhuber requested a review from a team July 9, 2018 14:01
Copy link
Contributor

@mcsf mcsf left a 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.

@danielbachhuber danielbachhuber merged commit fab861a into master Jul 9, 2018
@danielbachhuber danielbachhuber deleted the shortcode-convert-test-v2 branch July 9, 2018 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Paste [Feature] Shortcodes Related to shortcode functionality [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants