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:
parent
4aa42e4772
commit
b46eb1c699
@ -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.",
|
||||
|
||||
@ -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'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user