-
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.
Browse files
Browse the repository at this point in the history
* chore: Add test for block mover (#8011)
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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,40 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import '../support/bootstrap'; | ||
import { newPost, newDesktopBrowserPage } from '../support/utils'; | ||
|
||
describe( 'block mover', () => { | ||
beforeEach( async () => { | ||
await newDesktopBrowserPage(); | ||
await newPost(); | ||
} ); | ||
|
||
it( 'should show block mover when more than one block exists', async () => { | ||
// Create a two blocks on the page. | ||
await page.click( '.editor-default-block-appender' ); | ||
await page.keyboard.type( 'First Paragraph' ); | ||
await page.keyboard.press( 'Enter' ); | ||
await page.keyboard.type( 'Second Paragraph' ); | ||
|
||
// Select a block so the block mover is rendered. | ||
await page.focus( '.editor-block-list__block' ); | ||
|
||
const blockMover = await page.$$( '.editor-block-mover' ); | ||
// There should be a block mover. | ||
expect( blockMover ).toHaveLength( 1 ); | ||
} ); | ||
|
||
it( 'should hide block mover when only one block exists', async () => { | ||
// Create a single block on the page. | ||
await page.click( '.editor-default-block-appender' ); | ||
await page.keyboard.type( 'First Paragraph' ); | ||
|
||
// Select a block so the block mover has the possibility of being rendered. | ||
await page.focus( '.editor-block-list__block' ); | ||
|
||
// Ensure no block mover exists when only one block exists on the page. | ||
const blockMover = await page.$$( '.editor-block-mover' ); | ||
expect( blockMover ).toHaveLength( 0 ); | ||
} ); | ||
} ); |