Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e826e66
Remove unnecessary RegExp
ciampo Dec 22, 2023
6ca3f5d
Use @ariakit/test instead of testing library
ciampo Dec 22, 2023
6b5334f
Use sleep utility instead of custom promise
ciampo Dec 22, 2023
c97a986
Remove unnecessary import
ciampo Dec 22, 2023
8292091
Add utility functions
ciampo Dec 22, 2023
32b5703
Make multiple children test actually test what it's supposed to test
ciampo Dec 22, 2023
8cd4033
Test for tooltip to hide when another element gets focus
ciampo Dec 22, 2023
3894dca
Test for tooltip to hide when hovering outside the anchor
ciampo Dec 22, 2023
a6ca61f
Improve tooltip hiding on click test
ciampo Dec 22, 2023
7674cb0
More utils refactor
ciampo Dec 22, 2023
0c47cab
Improve test with disabled anchor
ciampo Dec 22, 2023
18a228c
Wait for tooltip to be hidden in the hideOnClick={false} test
ciampo Dec 22, 2023
5e590e3
Refactor custom delay test
ciampo Dec 22, 2023
4fe91bc
Refactor "mouse leave early" test (skip as it's still not passing)
ciampo Dec 22, 2023
be278f8
Improve shortcut-related tests
ciampo Dec 22, 2023
090e22b
Improve the Modal Escape test
ciampo Dec 22, 2023
b5aaf5a
Refactor description text test
ciampo Dec 22, 2023
cf1ea1a
Add second-level describes
ciampo Dec 22, 2023
2d4692a
Improve TS expecte error message
ciampo Jan 3, 2024
536ddeb
Add missing async/await in test utils
ciampo Jan 3, 2024
636678f
Await for tooltip to appear in shortcut tests
ciampo Jan 3, 2024
0e8c5e6
Apply delay prop only when showing the tooltip
ciampo Jan 3, 2024
57b5335
Add skip timeout waiting time after each test
ciampo Jan 3, 2024
21d2c0e
CHANGELOG
ciampo Jan 3, 2024
89372ed
Apply review feedback
ciampo Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve test with disabled anchor
  • Loading branch information
ciampo committed Jan 3, 2024
commit 0c47cab52a462c347b17bac277773897fa75fe26
22 changes: 13 additions & 9 deletions packages/components/src/tooltip/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,27 @@ describe( 'Tooltip', () => {
).toBeVisible();
} );

it( 'should show tooltip when an element is disabled', async () => {
it( 'should show tooltip when the anchor button is disabled but focusable', async () => {
render(
<Tooltip { ...props }>
<Button aria-disabled>Button</Button>
<Button disabled __experimentalIsFocusable>
Tooltip anchor
</Button>
</Tooltip>
);

const button = screen.getByRole( 'button', { name: 'Tooltip anchor' } );
const anchor = screen.getByRole( 'button', { name: 'Tooltip anchor' } );

expect( button ).toBeVisible();
expect( button ).toHaveAttribute( 'aria-disabled' );
expect( anchor ).toBeVisible();
expect( anchor ).toHaveAttribute( 'aria-disabled', 'true' );

await hover( button );
// Hover over the anchor, tooltip should show
await hover( anchor );
await waitForTooltipToShow();

expect(
await screen.findByRole( 'tooltip', { name: 'tooltip text' } )
).toBeVisible();
// Hover outside of the anchor, tooltip should hide
await hoverOutside();
await waitForTooltipToHide();
} );

it( 'should not show tooltip if the mouse leaves the tooltip anchor before set delay', async () => {
Expand Down