diff --git a/blocks/api/raw-handling/test/shortcode-converter.js b/blocks/api/raw-handling/test/shortcode-converter.js index 657690b997906e..2fe911ef02ba70 100644 --- a/blocks/api/raw-handling/test/shortcode-converter.js +++ b/blocks/api/raw-handling/test/shortcode-converter.js @@ -36,7 +36,31 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
Bar
` ); } ); - it( 'should convert multiple instances of the same shortcode', () => { + it( 'should convert two instances of the same shortcode', () => { + const original = `[foo one]
+[foo two]
`; + + const transformed = segmentHTMLToShortcodeBlock( original, 0 ); + expect( transformed[ 0 ] ).toEqual( '' ); + const firstExpectedBlock = createBlock( 'core/shortcode', { + text: '[foo one]', + } ); + // uid will always be random. + firstExpectedBlock.uid = transformed[ 1 ].uid; + expect( transformed[ 1 ] ).toEqual( firstExpectedBlock ); + expect( transformed[ 2 ] ).toEqual( `
+` ); + const secondExpectedBlock = createBlock( 'core/shortcode', { + text: '[foo two]', + } ); + // uid will always be random. + secondExpectedBlock.uid = transformed[ 3 ].uid; + expect( transformed[ 3 ] ).toEqual( secondExpectedBlock ); + expect( transformed[ 4 ] ).toEqual( '
' ); + expect( transformed ).toHaveLength( 5 ); + } ); + + it( 'should convert four instances of the same shortcode', () => { const original = `[foo one]
[foo two]
[foo three]