Skip to content

Commit

Permalink
fix(@schematics/angular): set inlineTemplate and inlineStyle for mini…
Browse files Browse the repository at this point in the history
…mal projects
  • Loading branch information
chrisguttandin authored and Keen Yee Liau committed Feb 18, 2020
1 parent 352c574 commit 3031631
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul

const schematics: JsonObject = {};

if (options.inlineTemplate === true
|| options.inlineStyle === true
if (options.inlineTemplate
|| options.inlineStyle
|| options.minimal
|| options.style !== Style.Css) {
const componentSchematicsOptions: JsonObject = {};
if (options.inlineTemplate === true) {
if (options.inlineTemplate || options.minimal) {
componentSchematicsOptions.inlineTemplate = true;
}
if (options.inlineStyle === true) {
if (options.inlineStyle || options.minimal) {
componentSchematicsOptions.inlineStyle = true;
}
if (options.style && options.style !== Style.Css) {
Expand Down
13 changes: 13 additions & 0 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ describe('Application Schematic', () => {
expect(architect.e2e).not.toBeDefined();
});

it('minimal=true should configure the schematics options for components', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
.toPromise();
const config = JSON.parse(tree.readContent('/angular.json'));
const schematics = config.projects.foo.schematics;
expect(schematics['@schematics/angular:component']).toEqual({
inlineTemplate: true,
inlineStyle: true,
skipTests: true,
});
});

it('should create correct files when using minimal', async () => {
const options = { ...defaultOptions, minimal: true };
const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree)
Expand Down

0 comments on commit 3031631

Please sign in to comment.