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

Pullquote: fix transform to quote crash #44315

Merged
merged 2 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/block-library/src/quote/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const transforms = {
fontSize,
style,
},
createBlock( 'core/paragraph', { content: value } )
[ createBlock( 'core/paragraph', { content: value } ) ]
);
},
},
Expand Down
47 changes: 47 additions & 0 deletions packages/e2e-tests/specs/editor/blocks/pullquote.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* WordPress dependencies
*/
import {
clickBlockAppender,
getEditedPostContent,
createNewPost,
transformBlockTo,
} from '@wordpress/e2e-test-utils';

describe( 'Quote', () => {
beforeEach( async () => {
await createNewPost();
} );

it( 'can be created by converting a quote and converted back to quote', async () => {
await clickBlockAppender();
await page.keyboard.type( 'test' );
await transformBlockTo( 'Quote' );

expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
"<!-- wp:quote -->
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
<p>test</p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->"
` );

await transformBlockTo( 'Pullquote' );

expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
"<!-- wp:pullquote -->
<figure class=\\"wp-block-pullquote\\"><blockquote><p>test</p></blockquote></figure>
<!-- /wp:pullquote -->"
` );

await transformBlockTo( 'Quote' );

expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
"<!-- wp:quote -->
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
<p>test</p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->"
` );
} );
} );