diff --git a/packages/block-editor/src/components/link-control/test/index.js b/packages/block-editor/src/components/link-control/test/index.js index ee48db15fd07f..56aeac6b2ee08 100644 --- a/packages/block-editor/src/components/link-control/test/index.js +++ b/packages/block-editor/src/components/link-control/test/index.js @@ -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' ); @@ -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', { @@ -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' );