Skip to content

Commit

Permalink
fix(@schematics/angular): split browserslist IE entries and provide b…
Browse files Browse the repository at this point in the history
…etter comments

Closes #18032
  • Loading branch information
alan-agius4 authored and filipesilva committed Jun 30, 2020
1 parent c402c31 commit 4e99531
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ last 2 Edge major versions
last 2 Safari major version
last 2 iOS major versions
Firefox ESR<% if (legacyBrowsers) { %>
IE 9-11<% } else { %>
not IE 9-11 # For IE 9-11 support, remove 'not'.<% } %>
IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11.
IE 11<% } else { %>
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.<% } %>
10 changes: 7 additions & 3 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,19 @@ describe('Application Schematic', () => {
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const content = tree.readContent('/projects/foo/.browserslistrc');
expect(content).not.toContain(`not IE 9-11 # For IE 9-11 support, remove 'not'.`);
expect(content).toContain('IE 9-11');
expect(content).not.toContain('not IE 11');
expect(content).toContain('IE 11');

expect(content).not.toContain('not IE 9-10');
expect(content).toContain('IE 9-10');
});

it(`should not add support for IE 9-11 in '.browserslistrc' when 'legacyBrowsers' is false`, async () => {
const options: ApplicationOptions = { ...defaultOptions, legacyBrowsers: false };
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const content = tree.readContent('/projects/foo/.browserslistrc');
expect(content).toContain(`not IE 9-11 # For IE 9-11 support, remove 'not'.`);
expect(content).toContain('not IE 11');
expect(content).toContain('not IE 9-10');
});
});
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/differential-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default async function() {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

// Remove the cache so that an initial build and build with cache can be tested
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/differential-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default async function () {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

await writeMultipleFiles({
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default async function () {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

await ng('build', '--aot=false');
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/prod-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default async function () {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

await ng('build', '--prod');
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/sourcemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default async function () {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

// The below is needed to cache bundles and verify that sourcemaps are generated
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default async function () {
// Enable Differential loading to run both size checks
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

await ng('generate', 'web-worker', 'app');
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/i18n/ivy-localize-dl-xliff2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export async function executeTest() {
// Ensure a DL build is used.
await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

await updateJsonFile('tsconfig.base.json', config => {
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/misc/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default async function () {

await replaceInFile(
'.browserslistrc',
'not IE 9-11',
'IE 9-11',
'not IE 11',
'IE 11',
);

if (!getGlobalVariable('argv')['ve']) {
Expand Down

0 comments on commit 4e99531

Please sign in to comment.