Skip to content

Commit d7caab0

Browse files
test: attach the printed stylesheet without a fake load event
FakeDocument fires onload 10 ms after appendChild, so on a slow runner the 'still pending' check raced it. A server-rendered link is parsed, not inserted, so attach it directly.
1 parent bdb561f commit d7caab0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • test/configCases/css/server-rendered-stylesheet-pending

‎test/configCases/css/server-rendered-stylesheet-pending/index.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ it("waits for a server-rendered stylesheet that has not applied yet", async () =
88
printed.rel = "stylesheet";
99
printed.href = "https://test.cases/button.css";
1010
printed.sheet = undefined;
11-
document.head.appendChild(printed);
11+
// parsed from the HTML, not inserted, so FakeDocument fires no load of its own
12+
document.head._attach(printed);
1213

1314
let loaded = false;
1415
const promise = import(/* webpackChunkName: "button" */ "./button.js").then(

0 commit comments

Comments
 (0)