Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion integration/express-engine-ivy/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"styles": [
"src/styles.css",
{
"input": "src/styles-extra.css",
"inject": true,
"bundleName": "extra"
}
],
"scripts": []
},
"configurations": {
Expand Down
8 changes: 6 additions & 2 deletions integration/express-engine-ivy/e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ describe('Hello world E2E Tests', () => {
await browser.driver.get(browser.baseUrl);

// Test the contents from the server.
const styleTag = browser.driver.findElement(by.css('link[rel="stylesheet"]'));
expect(styleTag.getAttribute('media')).toMatch('all');
const linkTags = await browser.driver.findElements(by.css('link[rel="stylesheet"]'));
expect(linkTags.length).toBe(2);

for (const linkTag of linkTags) {
expect(linkTag.getAttribute('media')).toMatch('all');
}

// Make sure there were no client side errors.
verifyNoBrowserErrors();
Expand Down
4 changes: 4 additions & 0 deletions integration/express-engine-ivy/src/styles-extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* You can add global styles to this file, and also import other style files */
.foo {
background-color: blue;
}
2 changes: 1 addition & 1 deletion modules/common/engine/src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class CommonEngine {
document: inlineCriticalCss
? // Workaround for https://github.com/GoogleChromeLabs/critters/issues/64
doc.replace(
/ media="print" onload="this\.media='.+'"(?: ngCspMedia=".+")?><noscript><link .+?><\/noscript>/g,
/ media="print" onload="this\.media='.+?'"(?: ngCspMedia=".+")?><noscript><link .+?><\/noscript>/g,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any unit test to verify this line of code?

Copy link
Collaborator Author

@alan-agius4 alan-agius4 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an e2e test that verifies this.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved.

'>',
)
: doc,
Expand Down