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: fix window.getComputedStyle arguments #10424

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions packages/calcite-components/src/components/alert/alert.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ describe("calcite-alert", () => {
await page.setContent(alertSnippet);
await page.waitForTimeout(alertQueueTimeoutMs);
alertDismissProgressBar = await page.find(`calcite-alert[open] >>> .${CSS.dismissProgress}`);
progressBarStyles = await alertDismissProgressBar.getComputedStyle(":after");
progressBarStyles = await alertDismissProgressBar.getComputedStyle("::after");
expect(await progressBarStyles.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.8)");
});
});
Expand All @@ -365,7 +365,7 @@ describe("calcite-alert", () => {
await page.setContent(html`<div class="calcite-mode-dark">${alertSnippet}</div>`);
await page.waitForTimeout(alertQueueTimeoutMs);
alertDismissProgressBar = await page.find(`calcite-alert[open] >>> .${CSS.dismissProgress}`);
progressBarStyles = await alertDismissProgressBar.getComputedStyle(":after");
progressBarStyles = await alertDismissProgressBar.getComputedStyle("::after");
expect(await progressBarStyles.getPropertyValue("background-color")).toEqual("rgba(43, 43, 43, 0.8)");
});
});
Expand All @@ -384,7 +384,7 @@ describe("calcite-alert", () => {
);
await page.waitForTimeout(alertQueueTimeoutMs);
alertDismissProgressBar = await page.find(`calcite-alert[open] >>> .${CSS.dismissProgress}`);
progressBarStyles = await alertDismissProgressBar.getComputedStyle(":after");
progressBarStyles = await alertDismissProgressBar.getComputedStyle("::after");
expect(await progressBarStyles.getPropertyValue("background-color")).toEqual(overrideStyle);
});
});
Expand Down
12 changes: 6 additions & 6 deletions packages/calcite-components/src/components/button/button.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,12 @@ describe("calcite-button", () => {
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle(":focus");
buttonFocusStyle = await buttonEl.getComputedStyle();
Copy link
Contributor

@anveshmekala anveshmekala Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: buttonFocusStyle can be changed to buttonStyle here to be more generic. Applies to other places.

expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");

await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle(":hover");
buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");
});
});
Expand All @@ -551,12 +551,12 @@ describe("calcite-button", () => {
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle(":focus");
buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");

await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle(":hover");
buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");
});
});
Expand All @@ -575,12 +575,12 @@ describe("calcite-button", () => {
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle(":focus");
buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual(overrideStyle);

await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle(":hover");
buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual(overrideStyle);
});
});
Expand Down
12 changes: 6 additions & 6 deletions packages/calcite-components/src/components/chip/chip.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ describe("calcite-chip", () => {
chipCloseButton = await page.find("calcite-chip >>> button");
await chipCloseButton.focus();
await page.waitForChanges();
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle(":focus");
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");

await chipCloseButton.hover();
await page.waitForChanges();
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle(":hover");
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");
});
});
Expand All @@ -176,12 +176,12 @@ describe("calcite-chip", () => {
chipCloseButton = await page.find("calcite-chip >>> button");
await chipCloseButton.focus();
await page.waitForChanges();
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle(":focus");
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");

await chipCloseButton.hover();
await page.waitForChanges();
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle(":hover");
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");
});
});
Expand All @@ -200,12 +200,12 @@ describe("calcite-chip", () => {
chipCloseButton = await page.find("calcite-chip >>> button");
await chipCloseButton.focus();
await page.waitForChanges();
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle(":focus");
chipCloseButtonFocusStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonFocusStyle.getPropertyValue("background-color")).toEqual(overrideStyle);

await chipCloseButton.hover();
await page.waitForChanges();
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle(":hover");
chipCloseButtonHoverStyle = await chipCloseButton.getComputedStyle();
expect(chipCloseButtonHoverStyle.getPropertyValue("background-color")).toEqual(overrideStyle);
});

Expand Down
Loading