Skip to content

Commit

Permalink
migrated test: is not created when we click away from the link input
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Jul 21, 2023
1 parent d2433a8 commit df392a4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
21 changes: 0 additions & 21 deletions packages/e2e-tests/specs/editor/various/links.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,6 @@ describe( 'Links', () => {
} );
};

it( 'is not created when we click away from the link input', async () => {
// Create a block with some text.
await clickBlockAppender();
await page.keyboard.type( 'This is Gutenberg' );

// Select some text.
await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' );

// Click on the Link button.
await page.click( 'button[aria-label="Link"]' );

// Wait for the URL field to auto-focus.
await waitForURLFieldAutoFocus();

// Type a URL.
await page.keyboard.type( 'https://wordpress.org/gutenberg' );

// Click somewhere else - it doesn't really matter where.
await canvas().click( '.editor-post-title' );
} );

const createAndReselectLink = async () => {
// Create a block with some text.
await clickBlockAppender();
Expand Down
35 changes: 35 additions & 0 deletions test/e2e/specs/editor/blocks/links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,41 @@ test.describe( 'Links', () => {
] );
} );

test( `is not created when we click away from the link input`, async ( {
page,
editor,
pageUtils,
} ) => {
// Create a block with some text.
await editor.insertBlock( {
name: 'core/paragraph',
} );
await page.keyboard.type( 'This is Gutenberg' );

// Select some text.
await pageUtils.pressKeys( 'shiftAlt+ArrowLeft' );

// Click on the Link button.
await page.getByRole( 'button', { name: 'Link' } ).click();

// Type a URL.
await page.keyboard.type( 'https://wordpress.org/gutenberg' );

// Click somewhere else - it doesn't really matter where.
await editor.canvas
.getByRole( 'textbox', { name: 'Add title' } )
.focus();

await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/paragraph',
attributes: {
content: 'This is Gutenberg',
},
},
] );
} );

test( `can be created by selecting text and using keyboard shortcuts`, async ( {
page,
editor,
Expand Down

0 comments on commit df392a4

Please sign in to comment.