fix(schematics): remove default prop for viewEncapsulation option flag

Also adds specs for confirming use with no flag and with flag
This commit is contained in:
Justin Schwartzenberger 2017-12-13 11:31:49 -08:00 committed by Victor Savkin
parent 4aa42e4772
commit b46eb1c699
3 changed files with 23 additions and 4 deletions

View File

@ -31,8 +31,7 @@
"viewEncapsulation": {
"description": "Specifies the view encapsulation strategy.",
"enum": ["Emulated", "Native", "None"],
"type": "string",
"default": "None"
"type": "string"
},
"changeDetection": {
"description": "Specifies the change detection strategy.",

View File

@ -148,4 +148,25 @@ describe('app', () => {
);
});
});
describe('view encapsulation', () => {
it('should not set Component encapsulation metadata if option flag not included', () => {
const tree = schematicRunner.runSchematic(
'app',
{ name: 'myApp', npmScope: 'nrwl', directory: 'myDir' },
appTree
);
expect(getFileContent(tree, 'apps/my-dir/my-app/src/app/app.component.ts')).not.toContain('encapsulation: ');
});
it('should set Component encapsulation metadata if option flag is included', () => {
const tree = schematicRunner.runSchematic(
'app',
{ name: 'myApp', npmScope: 'nrwl', directory: 'myDir', viewEncapsulation: 'Native' },
appTree
);
expect(getFileContent(tree, 'apps/my-dir/my-app/src/app/app.component.ts')).toContain(
'encapsulation: ViewEncapsulation.Native'
);
});
});
});

View File

@ -36,8 +36,7 @@
"viewEncapsulation": {
"description": "Specifies the view encapsulation strategy.",
"enum": ["Emulated", "Native", "None"],
"type": "string",
"default": "None"
"type": "string"
},
"changeDetection": {
"description": "Specifies the change detection strategy.",