Skip to content

Commit fc3780e

Browse files
alan-agius4clydin
authored andcommitted
test(@angular-devkit/build-angular): update tests to match critters 0.0.11 output
1 parent 94836e0 commit fc3780e

File tree

4 files changed

+16
-24
lines changed

4 files changed

+16
-24
lines changed

packages/angular_devkit/build_angular/src/app-shell/app-shell_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ describe('AppShell Builder', () => {
294294
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
295295

296296
expect(content).toContain('app-shell works!');
297-
expect(content).toContain('p{color:#000;}');
297+
expect(content).toContain('p{color:#000}');
298298
expect(content).toMatch(
299299
/<link rel="stylesheet" href="styles\.[a-z0-9]+\.css" media="print" onload="this\.media='all'">/,
300300
);

packages/angular_devkit/build_angular/src/browser/tests/options/inline-critical_spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
3737
.content.toContain(
3838
`<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">`,
3939
);
40-
harness.expectFile('dist/index.html').content.toContain(`body{color:#000;}`);
40+
harness.expectFile('dist/index.html').content.toContain(`body{color:#000}`);
4141
});
4242

4343
it(`should extract critical css when 'optimization' is unset`, async () => {
@@ -55,7 +55,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
5555
.content.toContain(
5656
`<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">`,
5757
);
58-
harness.expectFile('dist/index.html').content.toContain(`body{color:#000;}`);
58+
harness.expectFile('dist/index.html').content.toContain(`body{color:#000}`);
5959
});
6060

6161
it(`should extract critical css when 'optimization' is true`, async () => {
@@ -73,7 +73,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
7373
.content.toContain(
7474
`<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">`,
7575
);
76-
harness.expectFile('dist/index.html').content.toContain(`body{color:#000;}`);
76+
harness.expectFile('dist/index.html').content.toContain(`body{color:#000}`);
7777
});
7878

7979
it(`should not extract critical css when 'optimization' is false`, async () => {
@@ -131,7 +131,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
131131
.content.toContain(
132132
`<link rel="stylesheet" href="http://cdn.com/styles.css" media="print" onload="this.media='all'">`,
133133
);
134-
harness.expectFile('dist/index.html').content.toContain(`body{color:#000;}`);
134+
harness.expectFile('dist/index.html').content.toContain(`body{color:#000}`);
135135
});
136136

137137
it(`should extract critical css when using '@media all {}' and 'minify' is set to true`, async () => {
@@ -157,7 +157,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
157157
.content.toContain(
158158
`<link rel="stylesheet" href="styles.css" media="print" onload="this.media='all'">`,
159159
);
160-
harness.expectFile('dist/index.html').content.toContain(`body{color:#000;}`);
160+
harness.expectFile('dist/index.html').content.toContain(`body{color:#000}`);
161161
});
162162
});
163163
});

packages/angular_devkit/build_angular/src/dev-server/tests/behavior/build-inline-critical-css_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describeBuilder(serveWebpackBrowser, DEV_SERVER_BUILDER_INFO, (harness) => {
4444
const { result, response } = await executeOnceAndFetch(harness, '/');
4545

4646
expect(result?.success).toBeTrue();
47-
expect(await response?.text()).toContain('body{color:#000;}');
47+
expect(await response?.text()).toContain('body{color:#000}');
4848
});
4949
});
5050
});

packages/angular_devkit/build_angular/src/utils/index-file/inline-critical-css_spec.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,10 @@ describe('InlineCriticalCssProcessor', () => {
5858
);
5959
expect(content).not.toContain('color: blue');
6060
expect(tags.stripIndents`${content}`).toContain(tags.stripIndents`
61-
<style>body {
62-
margin: 0;
63-
}
64-
65-
html {
66-
color: white;
67-
}</style>
68-
`);
61+
<style>
62+
body { margin: 0; }
63+
html { color: white; }
64+
</style>`);
6965
});
7066

7167
it('should inline critical css when using deployUrl', async () => {
@@ -85,14 +81,10 @@ describe('InlineCriticalCssProcessor', () => {
8581
`<link href="http://cdn.com/theme.css" rel="stylesheet" media="print" onload="this.media='all'">`,
8682
);
8783
expect(tags.stripIndents`${content}`).toContain(tags.stripIndents`
88-
<style>body {
89-
margin: 0;
90-
}
91-
92-
html {
93-
color: white;
94-
}</style>
95-
`);
84+
<style>
85+
body { margin: 0; }
86+
html { color: white; }
87+
</style>`);
9688
});
9789

9890
it('should compress inline critical css when minify is enabled', async () => {
@@ -111,6 +103,6 @@ describe('InlineCriticalCssProcessor', () => {
111103
expect(content).toContain(
112104
`<link href="theme.css" rel="stylesheet" media="print" onload="this.media='all'">`,
113105
);
114-
expect(content).toContain('<style>body{margin:0;}html{color:white;}</style>');
106+
expect(content).toContain('<style>body{margin:0}html{color:white}</style>');
115107
});
116108
});

0 commit comments

Comments
 (0)