Skip to content

Commit

Permalink
Adds initial Block Toolbar integration tests related to the block set…
Browse files Browse the repository at this point in the history
…tings button
  • Loading branch information
Gerardo committed Jul 13, 2023
1 parent 4ed6b7a commit 9308013
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* External dependencies
*/
import {
addBlock,
fireEvent,
getBlock,
initializeEditor,
setupCoreBlocks,
} from 'test/helpers';

setupCoreBlocks();

describe( 'Block Toolbar', () => {
it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
// Arrange
const screen = await initializeEditor();
await addBlock( screen, 'Image' );

// Act
fireEvent(
screen.getByTestId( 'media-options-picker' ),
'backdropPress'
);

// Assert
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();
} );

it( 'renders the block settings button for the current selected block', async () => {
// Arrange
const screen = await initializeEditor();
await addBlock( screen, 'Paragraph' );

// Act
const paragraphBlock = await getBlock( screen, 'Paragraph' );
fireEvent.press( paragraphBlock );

// Assert
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeVisible();
} );
} );

0 comments on commit 9308013

Please sign in to comment.