Skip to content

Commit 79b04f3

Browse files
alexander-akaitclaude
authored andcommitted
test(html): hand the watch case a style body headed twice over
A page built twice by a webpack that kept the header it read carries a stack, and shedding it is one line the case never reached: with one header, a single strip and the loop that repeats it are the same code. The page now arrives headed twice, so `while` reading `if` fails it.
1 parent c33c990 commit 79b04f3

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎test/watchCases/css/html-style-module-header/0/index.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ const SHEET = ".a { color: red; }\n";
77
it("should head the sheet with the module it read, not the one the page came with", () => {
88
const style = readStyle(STATS_JSON);
99

10-
// The page arrives with a header of its own, as a page an earlier build
11-
// emitted does. That one was the build before's, so this build sheds it and
12-
// writes its own — one header, not two.
10+
// The page arrives headed twice over, as one built by a webpack that kept
11+
// the header it read does. They were those builds', so this one sheds the
12+
// stack whole and writes its own — one header, however many it was given.
1313
expect(style.headers).toHaveLength(1);
1414
expect(style.html).not.toContain(".stale");
15+
expect(style.html).not.toContain(".staler");
1516

1617
// The module it names is the sheet the author wrote, so what the build read
1718
// is the sheet alone and not the sheet under a header.

‎test/watchCases/css/html-style-module-header/0/page.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<style>/*!****************************************************************!*\
66
!*** css data:text/css;base64,LnN0YWxlIHt9 (exportType: text) ***!
77
\****************************************************************/
8+
/*!********************************************************************!*\
9+
!*** css data:text/css;base64,LnN0YWxlciB7fQ== (exportType: text) ***!
10+
\********************************************************************/
811
.a { color: red; }
912
</style>
1013
</head>

‎test/watchCases/css/html-style-module-header/1/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ it("should write a header for the sheet the rebuild read", () => {
1212
// there, and one cached against that module would still read `red`.
1313
expect(style.headers).toHaveLength(1);
1414
expect(style.html).not.toContain(".stale");
15+
expect(style.html).not.toContain(".staler");
1516
expect(style.names).toBe(SHEET);
1617
expect(style.heads).toBe(SHEET);
1718
});

‎test/watchCases/css/html-style-module-header/1/page.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<style>/*!****************************************************************!*\
66
!*** css data:text/css;base64,LnN0YWxlIHt9 (exportType: text) ***!
77
\****************************************************************/
8+
/*!********************************************************************!*\
9+
!*** css data:text/css;base64,LnN0YWxlciB7fQ== (exportType: text) ***!
10+
\********************************************************************/
811
.a { color: green; }
912
</style>
1013
</head>

0 commit comments

Comments
 (0)