Skip to content

Commit

Permalink
test(component-library): make sure hovering over a disabled link butt…
Browse files Browse the repository at this point in the history
…on shows a tooltip
  • Loading branch information
Haberkamp committed Jan 21, 2025
1 parent 3b635bd commit ce75164
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1092,4 +1092,33 @@ describe("mt-tooltip", () => {
// ARRANGE
expect(screen.getByRole("tooltip", { name: "Tooltip" })).toBeVisible();
});

it("shows the tooltip when hovering over the disabled link button", async () => {
// ARRANGE
render({
template: `
<mt-tooltip content="Tooltip" delayDurationInMs="100" hideDelayDurationInMs="50">
<template #default="params">
<mt-button v-bind="params" link="https://www.shopware.com" disabled>Hover to open tooltip</mt-button>
</template>
</mt-tooltip>`,
components: {
MtTooltip,
MtButton,
},
});

const user = userEvent.setup({
advanceTimers: vi.advanceTimersByTime,
});

// ACT
await user.hover(screen.getByRole("link"));

vi.advanceTimersByTime(100);
await flushPromises();

// ASSERT
expect(screen.getByRole("tooltip", { name: "Tooltip" })).toBeVisible();
});
});

0 comments on commit ce75164

Please sign in to comment.