Skip to content

Commit

Permalink
refactor: prepare tests for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpatiiuk committed Oct 10, 2024
1 parent d5020f6 commit cda7494
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -912,18 +912,16 @@ describe("calcite-color-picker", () => {
});

it("value as property", async () => {
// initialize page with calcite-color-picker to make it available in the evaluate callback below
const page = await newE2EPage({
html: "<calcite-color-picker></calcite-color-picker>",
html: "",
});
await page.setContent("");

await page.evaluate(async (color) => {
const picker = document.createElement("calcite-color-picker");
picker.value = color;
document.body.append(picker);

await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
await picker.componentOnReady();
}, initialColor);

expect(await getInternalColorAsHex(page)).toBe(initialColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export class Loader implements LocalizedComponent {
[CSS.loaderPart]: true,
[CSS.loaderPartId(index)]: true,
}}
key={index}
style={isDeterminate && index === 3 ? determinateStyle : undefined}
viewBox={viewbox}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("calcite-navigation-user", () => {
},
{
propertyName: "textDisabled",
value: "",
value: true,
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("calcite-navigation", () => {
reflects("calcite-navigation", [
{
propertyName: "navigationAction",
value: "",
value: true,
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("calcite-pick-list-item", () => {
});

describe("honors hidden attribute", () => {
hidden("calcite-list-item");
hidden("calcite-pick-list-item");
});

// eslint-disable-next-line jest/no-disabled-tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ describe("calcite-rating", () => {
expect(labels[4]).not.toHaveClass("partial");
});

it("should update the ui of the rating when a hover event triggers on a rating label", async () => {
it("should update the UI of the rating when a hover event triggers on a rating label", async () => {
const page = await newE2EPage();
await page.setContent("<calcite-rating average=3.5></calcite-rating>");
const element = await page.find("calcite-rating");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("calcite-shell-panel", () => {
"calcite-shell-panel",
(panel: HTMLCalciteShellPanelElement, containerClass: string, contentClass: string) => {
const container = panel.shadowRoot.querySelector(containerClass);
return container.firstElementChild.className == contentClass;
return container.firstElementChild.classList.contains(contentClass);
},
`.${CSS.container}`,
CSS.content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ describe("calcite-time-picker", () => {
await page.mouse.click(buttonUpLocationX, buttonUpLocationY);
await page.waitForChanges();
const fractionalSecondEl = await page.find(`calcite-time-picker >>> .input.fractionalSecond`);
expect(fractionalSecondEl.innerHTML).toEqual("0");
expect(fractionalSecondEl.textContent).toEqual("0");
});

it("upward nudge of empty fractional second sets to 00 for step=0.01", async () => {
Expand All @@ -1228,7 +1228,7 @@ describe("calcite-time-picker", () => {
await page.mouse.click(buttonUpLocationX, buttonUpLocationY);
await page.waitForChanges();
const fractionalSecondEl = await page.find(`calcite-time-picker >>> .input.fractionalSecond`);
expect(fractionalSecondEl.innerHTML).toEqual("00");
expect(fractionalSecondEl.textContent).toEqual("00");
});

it("upward nudge of empty fractional second sets to 000 for step=0.001", async () => {
Expand All @@ -1242,7 +1242,7 @@ describe("calcite-time-picker", () => {
await page.mouse.click(buttonUpLocationX, buttonUpLocationY);
await page.waitForChanges();
const fractionalSecondEl = await page.find(`calcite-time-picker >>> .input.fractionalSecond`);
expect(fractionalSecondEl.innerHTML).toEqual("000");
expect(fractionalSecondEl.textContent).toEqual("000");
});
});
});
2 changes: 1 addition & 1 deletion packages/calcite-components/src/utils/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function invalidHandler(event: Event) {
formComponent.status = "idle";
}

if ("validationIcon" in formComponent && !formComponent.validationIcon) {
if ("validationIcon" in formComponent) {
formComponent.validationIcon = false;
}

Expand Down

0 comments on commit cda7494

Please sign in to comment.