Skip to content

Commit

Permalink
fix(schematics): remove default prop for viewEncapsulation option flag
Browse files Browse the repository at this point in the history
Also adds specs for confirming use with no flag and with flag
  • Loading branch information
jschwarty authored and vsavkin committed Dec 14, 2017
1 parent 4aa42e4 commit b46eb1c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/bazel/src/app/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
21 changes: 21 additions & 0 deletions packages/schematics/src/collection/app/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
});
});
});
3 changes: 1 addition & 2 deletions packages/schematics/src/collection/app/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit b46eb1c

Please sign in to comment.