Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scurker committed Jan 28, 2025
1 parent df88cf2 commit 048b247
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/react/src/components/OptionsMenu/OptionsMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@ test('should toggle menu on trigger clicks', async () => {

await user.click(button);
expect(button).toHaveAttribute('aria-expanded', 'true');
expect(screen.getByRole('menu')).toHaveAttribute('aria-expanded', 'true');

await user.click(button);

expect(button).toHaveAttribute('aria-expanded', 'false');
expect(screen.getByRole('menu')).toHaveAttribute('aria-expanded', 'false');
expect(screen.getByRole('menu')).toHaveClass('OptionsMenu--expanded');
});

test('should click trigger with down key on trigger', () => {
Expand Down Expand Up @@ -188,10 +185,12 @@ test('should close menu when click outside event occurs', async () => {
</>
);

await user.click(screen.getByRole('button', { name: 'trigger' }));
expect(screen.getByRole('menu')).toHaveAttribute('aria-expanded', 'true');
const triggerButton = screen.getByRole('button', { name: 'trigger' });
await user.click(triggerButton);
expect(triggerButton).toHaveAttribute('aria-expanded', 'true');
await user.click(screen.getByRole('button', { name: 'Click me!' }));
expect(screen.getByRole('menu')).toHaveAttribute('aria-expanded', 'false');
expect(triggerButton).toHaveAttribute('aria-expanded', 'false');
expect(screen.getByRole('menu')).not.toHaveClass('OptionsMenu--expanded');
});

test('should return no axe violations when hidden', async () => {
Expand Down

0 comments on commit 048b247

Please sign in to comment.