Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(popover): ensure popover doesn't reopen when trigger is clicked and autoClose is true #10948

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading