Skip to content

Commit

Permalink
Add test to LinkPreview to check for tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
brookewp committed Oct 6, 2023
1 parent f919481 commit e4282ab
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 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 @@ -2056,6 +2056,26 @@ describe( 'Addition Settings UI', () => {
} )
);
} );

it( 'should show tooltip with full URL alongside filtered display', async () => {
const user = userEvent.setup();
const url = 'https://example.com';
render( <LinkControl value={ { url } } /> );

const link = screen.getByRole( 'link' );

expect( screen.getByRole( 'link' ) ).toHaveTextContent(
/example.com/i
);

await user.hover( link );

expect( await screen.findByRole( 'tooltip' ) ).toHaveTextContent( url );

await user.unhover( link );

expect( screen.queryByRole( 'tooltip' ) ).not.toBeInTheDocument();
} );
} );

describe( 'Post types', () => {
Expand Down

0 comments on commit e4282ab

Please sign in to comment.