Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 6d7a7ea

Browse files
committed
fix(@schematics/angular): Set encaptulation value correctly
Fixes angular/angular-cli#8082
1 parent ecb480e commit 6d7a7ea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/schematics/angular/component/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Component, OnInit<% if(viewEncapsulation !== 'None') { %>, ViewEncapsul
99
`,<% } else { %>
1010
templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %>
1111
styles: []<% } else { %>
12-
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>']<% } %><% if(viewEncapsulation !== 'None') { %>,
12+
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>']<% } %><% if(viewEncapsulation !== 'Emulated') { %>,
1313
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
1414
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
1515
})

packages/schematics/angular/component/index_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ describe('Component Schematic', () => {
6262
expect(tsContent).toMatch(/changeDetection: ChangeDetectionStrategy.OnPush/);
6363
});
6464

65-
it('should set view encapsulation to Emulated', () => {
66-
const options = { ...defaultOptions, viewEncapsulation: 'Emulated' };
65+
it('should set view encapsulation to None', () => {
66+
const options = { ...defaultOptions, viewEncapsulation: 'None' };
6767

6868
const tree = schematicRunner.runSchematic('component', options, appTree);
6969
const tsContent = getFileContent(tree, '/src/app/foo/foo.component.ts');
70-
expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.Emulated/);
70+
expect(tsContent).toMatch(/encapsulation: ViewEncapsulation.None/);
7171
});
7272

7373
it('should create a flat component', () => {

0 commit comments

Comments
 (0)