Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { <%= classify(name) %><%= classify(type) %> } from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';
import <% if(!exportDefault) { %>{ <% }%><%= classify(name) %><%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';

describe('<%= classify(name) %><%= classify(type) %>', () => {
let component: <%= classify(name) %><%= classify(type) %>;
Expand Down
6 changes: 6 additions & 0 deletions packages/schematics/angular/component/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ describe('Component Schematic', () => {
const tree = await schematicRunner.runSchematic('component', options, appTree);
const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
expect(tsContent).toContain('export default class FooComponent');

const specContent = tree.readContent('/projects/bar/src/app/foo/foo.component.spec.ts');
expect(specContent).toContain("import FooComponent from './foo.component';");
});

it('should export the component as a named export when exportDefault is false', async () => {
Expand All @@ -519,5 +522,8 @@ describe('Component Schematic', () => {
const tree = await schematicRunner.runSchematic('component', options, appTree);
const tsContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
expect(tsContent).toContain('export class FooComponent');

const specContent = tree.readContent('/projects/bar/src/app/foo/foo.component.spec.ts');
expect(specContent).toContain("import { FooComponent } from './foo.component';");
});
});