Skip to content

Commit f0d20ba

Browse files
committed
Stabilize taskbar measurement test
1 parent 3cde0b0 commit f0d20ba

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

apps/desktop-tauri/src/surfaces/TaskbarStatusMeasure.test.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render, screen, within } from "@testing-library/react";
1+
import { render, screen, waitFor, within } from "@testing-library/react";
22
// @ts-ignore Vitest executes tests in Node; the browser build does not include test modules.
33
import { readFileSync } from "node:fs";
44
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -56,7 +56,9 @@ describe("TaskbarStatusMeasure", () => {
5656
render(<TaskbarStatusMeasure />);
5757

5858
const measurement = await screen.findByTestId("taskbar-status-measurement");
59-
expect(measurement.style.getPropertyValue("--surface-bg-alpha")).toBe("0.8");
59+
await waitFor(() =>
60+
expect(measurement.style.getPropertyValue("--surface-bg-alpha")).toBe("0.8"),
61+
);
6062
});
6163

6264
it("keeps the rendered root alpha from being shadowed by a descendant fallback", async () => {
@@ -66,7 +68,9 @@ describe("TaskbarStatusMeasure", () => {
6668
render(<TaskbarStatusMeasure />);
6769

6870
const measurement = await screen.findByTestId("taskbar-status-measurement");
69-
expect(measurement.style.getPropertyValue("--surface-bg-alpha")).toBe("0.8");
71+
await waitFor(() =>
72+
expect(measurement.style.getPropertyValue("--surface-bg-alpha")).toBe("0.8"),
73+
);
7074
for (const descendant of measurement.querySelectorAll<HTMLElement>("*")) {
7175
expect(descendant.style.getPropertyValue("--surface-bg-alpha")).toBe("");
7276
}

0 commit comments

Comments
 (0)