Skip to content

Commit

Permalink
Adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Nov 22, 2024
1 parent 0ff3752 commit 729124b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/react/src/Popover/Trigger/PopoverTrigger.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,29 @@ describe('<Popover.Trigger />', () => {
expect(trigger).not.to.have.attribute('data-pressed');
});

it('should not have the data-popup-open and data-pressed attributes when open by click when `openOnHover=true` and `delay=0`', async () => {
const { user } = await render(
<Popover.Root delay={0} openOnHover animated={false}>
<Popover.Trigger />
</Popover.Root>,
);

const trigger = screen.getByRole('button');

await user.hover(trigger);

// Closes instantly after opening due to `useClick` prop `stickIfOpen=false`
await act(async () => {
trigger.click();
});

expect(trigger).not.to.have.attribute('data-popup-open');
expect(trigger).not.to.have.attribute('data-pressed');
});

it('should have the data-popup-open and data-pressed attributes when open by click when `openOnHover=true`', async () => {
const { user } = await render(
<Popover.Root openOnHover delay={0} animated={false}>
<Popover.Root openOnHover animated={false}>
<Popover.Trigger />
</Popover.Root>,
);
Expand Down

0 comments on commit 729124b

Please sign in to comment.