Skip to content

Commit

Permalink
feat(new): include routing in spec and inline template when called wi…
Browse files Browse the repository at this point in the history
…th `--routing` (#3252)
  • Loading branch information
Meligy authored and hansl committed Dec 1, 2016
1 parent 46efa9e commit 53ab4df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/* tslint:disable:no-unused-variable */

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

describe('AppComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
TestBed.configureTestingModule({<% if (routing) { %>
imports: [
RouterTestingModule
],<% } %>
declarations: [
AppComponent
],
});
TestBed.compileComponents();
});

it('should create the app', async(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { APP_SHELL_DIRECTIVES } from '@angular/app-shell';<% } %>
template: `
<h1>
{{title}}
</h1>
</h1><% if (routing) { %>
<router-outlet></router-outlet><% } %>
`,<% } else { %>
templateUrl: './app.component.html',<% } %><% if (inlineStyle) { %>
styles: []<% } else { %>
Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/tests/commands/new/new-routing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as path from 'path';
import {ng} from '../../../utils/process';
import {getGlobalVariable} from '../../../utils/env';

export default function() {
return Promise.resolve()
.then(() => process.chdir(getGlobalVariable('tmp-root')))
.then(() => ng('new', 'routing-project', '--routing'))
.then(() => process.chdir(path.join('routing-project')))

// Try to run the unit tests.
.then(() => ng('test', '--single-run'));
}

0 comments on commit 53ab4df

Please sign in to comment.