Skip to content

Commit

Permalink
Pullquote: fix transform to quote crash (#44315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Sep 21, 2022
1 parent 9b00ba8 commit 3047038
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
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 -->"
` );
} );
} );

0 comments on commit 3047038

Please sign in to comment.