Skip to content

Commit

Permalink
fix incorrect page refs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfranco committed Nov 16, 2024
1 parent d85f61a commit 85ca57f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe("calcite-segmented-control", () => {
<calcite-segmented-control-item value="2">two</calcite-segmented-control-item>
</calcite-segmented-control>
`;
await page.waitForChanges();
await waitForFrame();

[first, second] = Array.from(document.querySelectorAll("calcite-segmented-control-item"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ describe("calcite-stepper", () => {
);

document.body.innerHTML = `<${wrapperName}></${wrapperName}>`;
await page.waitForChanges();
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));

const wrapper = document.querySelector(wrapperName);
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
Expand Down
27 changes: 13 additions & 14 deletions packages/calcite-components/src/components/tabs/tabs.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ describe("calcite-tabs", () => {
async (templateHTML: string): Promise<{ tabTitle: string; tab: string }> => {
const wrapperName = "tab-wrapping-component";

async function waitForAnimationFrames(count: number): Promise<void> {
async function frame() {
if (count > 0) {
await new Promise((resolve) => requestAnimationFrame(resolve));
count--;
await frame();
}
}

await frame();
}

customElements.define(
wrapperName,
class extends HTMLElement {
Expand All @@ -223,24 +235,11 @@ describe("calcite-tabs", () => {
);

document.body.innerHTML = `<${wrapperName}></${wrapperName}>`;
await page.waitForChanges();
await waitForAnimationFrames(2);

const wrapper = document.querySelector(wrapperName);

async function waitForAnimationFrames(count) {
async function frame() {
if (count > 0) {
await new Promise((resolve) => requestAnimationFrame(resolve));
count--;
await frame();
}
}

await frame();
}

wrapper.shadowRoot.querySelector<HTMLElement>("#title-2").click();
await waitForAnimationFrames(4);

const tabTitle = wrapper.shadowRoot.querySelector("calcite-tab-title[selected]").id;
await waitForAnimationFrames(2);
Expand Down

0 comments on commit 85ca57f

Please sign in to comment.