Skip to content

Commit

Permalink
WIP insert embed from slash inserter.
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-alexander committed Oct 27, 2021
1 parent b75b4e9 commit 9b4287d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/block-library/src/embed/test/index.native.js
Expand Up @@ -816,4 +816,36 @@ describe( 'Embed block', () => {

expect( cannotEmbedText ).toBeDefined();
} );

it( 'insert embed from slash inserter', async () => {
const embedBlockSlashInserter = '/Embed';
const { getByPlaceholderText, getByA11yLabel } = await initializeEditor(
{
initialHtml:
'<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->',
}
);

const paragraphText = getByPlaceholderText( 'Start writing…' );
fireEvent( paragraphText, 'focus' );
fireEvent( paragraphText, 'onChange', {
nativeEvent: {
eventCount: 1,
target: undefined,
text: embedBlockSlashInserter,
},
} );

fireEvent.press(
await waitFor( () => getByA11yLabel( 'Embed block' ) )
);

const block = await waitFor( () =>
getByA11yLabel( /Embed Block\. Row 1/ )
);

const blockName = within( block ).getByText( 'Embed' );

expect( blockName ).toBeDefined();
} );
} );

0 comments on commit 9b4287d

Please sign in to comment.