-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds initial Block Toolbar integration tests related to the block set…
…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.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
packages/block-editor/src/components/block-toolbar/test/index.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} ); | ||
} ); |