Skip to content

Commit

Permalink
fixup: s/invisible/hidden/ in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed Apr 22, 2024
1 parent 441eb3a commit 3d9cdcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ describe('Restricted Text Input', () => {
// Type a single invalid character, which shows the tooltip but does not wiggle
await user.type(input, 'a');

expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');
expect(tooltip).not.toHaveClass('animate-wiggle');
await waitFor(() => expect(tooltip).toHaveClass('invisible'));
await waitFor(() => expect(tooltip).toHaveClass('hidden'));

// Type multiple invalid characters, which shows the tooltip and wiggles
await user.type(input, 'aa');

expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');
expect(tooltip).toHaveClass('animate-wiggle');
await waitFor(() => expect(tooltip).not.toHaveClass('animate-wiggle'));
});
Expand Down
24 changes: 12 additions & 12 deletions packages/core/src/lib/tooltip/__tests__/tooltip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Tooltip', () => {
const tooltip = screen.getByRole('tooltip');

expect(target).toBeInTheDocument();
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
});

it('passes the tooltip ID to the target slot', () => {
Expand All @@ -34,15 +34,15 @@ describe('Tooltip', () => {
const tooltip = screen.getByRole('tooltip');

// tooltip should initially be invisible before styles calculate
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
// then it should become visible
await waitFor(() => expect(tooltip).not.toHaveClass('invisible'));

await user.hover(target);
expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');

await user.unhover(target);
expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');
});

it('does not render the tooltip when state is invisible', async () => {
Expand All @@ -54,14 +54,14 @@ describe('Tooltip', () => {
const tooltip = screen.getByRole('tooltip');

// tooltip should initially be invisible before styles calculate
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');

// tooltip should stay invisible despite hover state
await user.hover(target);
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');

await user.unhover(target);
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
});

it('shows/hides the tooltip on mouse enter/exit', async () => {
Expand All @@ -73,10 +73,10 @@ describe('Tooltip', () => {
const tooltip = screen.getByRole('tooltip');

await user.hover(target);
expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');

await user.unhover(target);
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
});

it('shows the tooltip on mouse enter after a delay', async () => {
Expand All @@ -88,7 +88,7 @@ describe('Tooltip', () => {
const tooltip = screen.getByRole('tooltip');

await user.hover(target);
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
await waitFor(() => expect(tooltip).not.toHaveClass('invisible'));
});

Expand All @@ -100,10 +100,10 @@ describe('Tooltip', () => {

await userEvent.tab();
expect(target).toHaveFocus();
expect(tooltip).not.toHaveClass('invisible');
expect(tooltip).not.toHaveClass('hidden');

await userEvent.tab();
expect(target).not.toHaveFocus();
expect(tooltip).toHaveClass('invisible');
expect(tooltip).toHaveClass('hidden');
});
});

0 comments on commit 3d9cdcc

Please sign in to comment.