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.
33import { readFileSync } from "node:fs" ;
44import { 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