Skip to content

Commit

Permalink
Assert that premature submission is not possible via UI
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Sep 5, 2023
1 parent 535b851 commit 804bd3c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/block-editor/src/components/link-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,12 @@ describe( 'Link submission', () => {
expect( submitButton ).toBeVisible();
expect( submitButton ).toHaveAttribute( 'aria-disabled', 'true' );

// Click the button and check it's not possible to prematurely submit the link.
await user.click( submitButton );

expect( searchInput ).toBeVisible();
expect( submitButton ).toBeVisible();

await user.type( searchInput, 'https://wordpress.org' );

expect( submitButton ).toHaveAttribute( 'aria-disabled', 'false' );
Expand Down Expand Up @@ -989,6 +995,7 @@ describe( 'Link submission', () => {
name: 'Submit',
} );

// Check the submit button for "creation" of links is not displayed.
expect( createSubmitButton ).not.toBeInTheDocument();

const editSubmitButton = screen.getByRole( 'button', {
Expand All @@ -998,6 +1005,12 @@ describe( 'Link submission', () => {
expect( editSubmitButton ).toBeVisible();
expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'true' );

// Click the button and check it's not possible to prematurely submit the link.
await user.click( editSubmitButton );

expect( searchInput ).toBeVisible();
expect( editSubmitButton ).toBeVisible();

await user.type( searchInput, '#appendtolinktext' );

expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'false' );
Expand Down

0 comments on commit 804bd3c

Please sign in to comment.