diff --git a/packages/schematics/angular/component/index_spec.ts b/packages/schematics/angular/component/index_spec.ts index 510cb14ded1b..aa54f1b9ec99 100644 --- a/packages/schematics/angular/component/index_spec.ts +++ b/packages/schematics/angular/component/index_spec.ts @@ -497,19 +497,19 @@ describe('Component Schematic', () => { }); }); - it('should use export default', async () => { + it('should export the component as default when exportDefault is true', async () => { const options = { ...defaultOptions, exportDefault: true }; const tree = await schematicRunner.runSchematic('component', options, appTree); const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts'); - expect(tsContent).toMatch('export default class'); + expect(tsContent).toContain('export default class FooComponent'); }); - it('should use named export', async () => { + it('should export the component as a named export when exportDefault is false', async () => { const options = { ...defaultOptions, exportDefault: false }; const tree = await schematicRunner.runSchematic('component', options, appTree); const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts'); - expect(tsContent).toMatch('export class'); + expect(tsContent).toContain('export class FooComponent'); }); }); diff --git a/packages/schematics/angular/component/schema.json b/packages/schematics/angular/component/schema.json index 4cdc4f10762b..9b95d4f1b8f3 100644 --- a/packages/schematics/angular/component/schema.json +++ b/packages/schematics/angular/component/schema.json @@ -134,7 +134,7 @@ "exportDefault": { "type": "boolean", "default": false, - "description": "Create a component with default export." + "description": "Use default export for the component instead of a named export." } }, "required": ["name", "project"]