Skip to content

Commit

Permalink
test(popover): ensure popover doesn't reopen when trigger is clicked …
Browse files Browse the repository at this point in the history
…and autoClose is true (#10948)

**Related Issue:** #10867

## Summary
Ensure `popover` doesn't reopen when the trigger is clicked and
`autoClose` is true.
  • Loading branch information
Elijbet authored Dec 3, 2024
1 parent b779cbf commit 0102371
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/calcite-components/src/components/popover/popover.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,31 @@ describe("calcite-popover", () => {
expect(await popover.getProperty("open")).toBe(false);
});

it("should not reopen when trigger is clicked and autoClose=true", async () => {
const page = await newE2EPage();

await page.setContent(html`
<calcite-popover auto-close reference-element="ref">Content</calcite-popover>
<button id="ref">Button</button>
`);

await page.waitForChanges();
const popover = await page.find("calcite-popover");

expect(await popover.getProperty("open")).toBe(false);

const referenceElement = await page.find("#ref");
await referenceElement.click();
await page.waitForChanges();

expect(await popover.getProperty("open")).toBe(true);

await referenceElement.click();
await page.waitForChanges();

expect(await popover.getProperty("open")).toBe(false);
});

describe("setFocus", () => {
const createPopoverHTML = (contentHTML?: string, attrs?: string) =>
`<calcite-popover open ${attrs} reference-element="ref">${contentHTML}</calcite-popover><button id="ref">Button</button>`;
Expand Down

0 comments on commit 0102371

Please sign in to comment.