Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored and draganescu committed Feb 7, 2023
1 parent 935c7ef commit 78ebdae
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/e2e/specs/editor/blocks/buttons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@ test.describe( 'Buttons', () => {
).toBeVisible();
} );

test( 'appends http protocol to links added which are missing a protocol', async ( {
editor,
page,
pageUtils,
} ) => {
// Regression: https://github.com/WordPress/gutenberg/issues/34307
await editor.insertBlock( { name: 'core/buttons' } );
await pageUtils.pressKeyWithModifier( 'primary', 'k' );
await expect(
page.locator( 'role=combobox[name="URL"i]' )
).toBeFocused();
await page.keyboard.type( 'example.com' );
await page.keyboard.press( 'Enter' );

// Move to "Edit" and switch back to edit
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Enter' );

// Check the value of the URL input has had http:// prepended.
const urlInput = await page.locator( 'role=combobox[name="URL"i]' );

await expect( urlInput ).toHaveValue( 'http://example.com' );
} );

test( 'can jump to the link editor using the keyboard shortcut', async ( {
editor,
page,
Expand Down

0 comments on commit 78ebdae

Please sign in to comment.