Skip to content

Commit

Permalink
Add e2e test for the table block caption
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Jun 10, 2019
1 parent 24e743b commit d62910f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Table allows a caption to be added 1`] = `
"<!-- wp:table -->
<table class=\\"wp-block-table\\"><caption>Caption!</caption><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table>
<!-- /wp:table -->"
`;
exports[`Table allows header and footer rows to be switched on and off 1`] = `
"<!-- wp:table -->
<table class=\\"wp-block-table\\"><thead><tr><th>header</th><th></th></tr></thead><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td>footer</td><td></td></tr></tfoot></table>
Expand Down
15 changes: 15 additions & 0 deletions packages/e2e-tests/specs/blocks/table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,19 @@ describe( 'Table', () => {
// Expect the table to have only a body with written content.
expect( await getEditedPostContent() ).toMatchSnapshot();
} );

it( 'allows a caption to be added', async () => {
await insertBlock( 'Table' );

// Create the table.
const createButton = await page.$x( "//div[@data-type='core/table']//button[text()='Create']" );
await createButton[ 0 ].click();

// Click the first cell and add some text.
await page.click( '.wp-block-table__caption-content' );
await page.keyboard.type( 'Caption!' );

// Expect the post to have the correct written content inside the table.
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
} );

0 comments on commit d62910f

Please sign in to comment.