Skip to content

Commit d0e7918

Browse files
committed
fix(ng): include routing in spec and inline template when called with --routing
1 parent 54ef738 commit d0e7918

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
/* tslint:disable:no-unused-variable */
22

3-
import { TestBed, async } from '@angular/core/testing';
3+
import { TestBed, async } from '@angular/core/testing';<% if (routing) { %>
4+
import { RouterTestingModule } from '@angular/router/testing';<% } %>
45
import { AppComponent } from './app.component';
56

67
describe('AppComponent', () => {
78
beforeEach(() => {
8-
TestBed.configureTestingModule({
9+
TestBed.configureTestingModule({<% if (routing) { %>
10+
imports: [
11+
RouterTestingModule
12+
],<% } %>
913
declarations: [
1014
AppComponent
1115
],

packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { APP_SHELL_DIRECTIVES } from '@angular/app-shell';<% } %>
66
template: `
77
<h1>
88
{{title}}
9-
</h1>
9+
</h1><% if (routing) { %>
10+
<router-outlet></router-outlet><% } %>
1011
`,<% } else { %>
1112
templateUrl: './app.component.html',<% } %><% if (inlineStyle) { %>
1213
styles: []<% } else { %>

0 commit comments

Comments
 (0)