Skip to content

Commit

Permalink
chore: Add test for block mover (#8011) (#8392)
Browse files Browse the repository at this point in the history
* chore: Add test for block mover (#8011)
  • Loading branch information
tofumatt authored Aug 7, 2018
1 parent d74a4fc commit 47a69e1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/e2e/specs/block-mover.test.js
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 );
} );
} );

0 comments on commit 47a69e1

Please sign in to comment.