Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jan 3, 2020
1 parent d03c51c commit 6d0cfbc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
12 changes: 6 additions & 6 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ function URLPicker( { isSelected, url, title, setAttributes, opensInNewTab, onTo
<>
<BlockControls>
<ToolbarGroup>
<KeyboardShortcuts
bindGlobal
shortcuts={ {
[ rawShortcut.primary( 'k' ) ]: openLinkControl,
} }
/>
<ToolbarButton
name="link"
icon="admin-links"
Expand All @@ -162,6 +156,12 @@ function URLPicker( { isSelected, url, title, setAttributes, opensInNewTab, onTo
/>
</ToolbarGroup>
</BlockControls>
<KeyboardShortcuts
bindGlobal
shortcuts={ {
[ rawShortcut.primary( 'k' ) ]: openLinkControl,
} }
/>
{ linkControl }
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Buttons can jump focus back & forth 1`] = `
exports[`Buttons can jump to the link editor using the keyboard shortcut 1`] = `
"<!-- wp:buttons -->
<div class=\\"wp-block-buttons\\"><!-- wp:button -->
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\">WordPress</a></div>
<!-- /wp:button -->
<!-- wp:button -->
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link\\">Button!</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->"
`;
Expand Down
7 changes: 4 additions & 3 deletions packages/e2e-tests/specs/editor/blocks/buttons.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
insertBlock,
getEditedPostContent,
createNewPost,
pressKeyWithModifier,
} from '@wordpress/e2e-test-utils';

describe( 'Buttons', () => {
Expand All @@ -19,12 +20,12 @@ describe( 'Buttons', () => {
expect( await getEditedPostContent() ).toMatchSnapshot();
} );

it( 'can jump focus back & forth', async () => {
it( 'can jump to the link editor using the keyboard shortcut', async () => {
await insertBlock( 'Buttons' );
await page.keyboard.type( 'WordPress' );
await page.keyboard.press( 'Tab' );
await pressKeyWithModifier( 'primary', 'k' );
await page.keyboard.type( 'https://wwww.wordpress.org/' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'Button!' );

expect( await getEditedPostContent() ).toMatchSnapshot();
} );
Expand Down

0 comments on commit 6d0cfbc

Please sign in to comment.