From cffd8edbd295d4073b33631a760fe1b38be2a586 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Mon, 1 May 2017 15:41:05 -0400 Subject: [PATCH 1/5] feat(@angular/cli): adding language service and animations --- packages/@angular/cli/blueprints/ng/files/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@angular/cli/blueprints/ng/files/package.json b/packages/@angular/cli/blueprints/ng/files/package.json index ae074b924b78..2c5e65d01a8e 100644 --- a/packages/@angular/cli/blueprints/ng/files/package.json +++ b/packages/@angular/cli/blueprints/ng/files/package.json @@ -12,11 +12,13 @@ }, "private": true, "dependencies": { + "@angular/animations": "^4.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", + "@angular/language-service": "^4.0.0", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", From 85ad3231ee3fc9d852d7f386900e99ff37b57a14 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Mon, 1 May 2017 15:41:25 -0400 Subject: [PATCH 2/5] feat(@angular/cli): removed loading from index.html --- packages/@angular/cli/blueprints/ng/files/__path__/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/index.html b/packages/@angular/cli/blueprints/ng/files/__path__/index.html index f4916b4ba356..4d12a74b3a92 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/index.html +++ b/packages/@angular/cli/blueprints/ng/files/__path__/index.html @@ -9,6 +9,6 @@ - <<%= prefix %>-root>Loading...-root> + <<%= prefix %>-root>-root> From 2b95dbaf441213b9474b97e10f044be0c9dd6462 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Mon, 1 May 2017 15:41:40 -0400 Subject: [PATCH 3/5] feat(@angular/cli): removed Forms and Http Module from app.module.ts --- .../cli/blueprints/ng/files/__path__/app/app.module.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.module.ts b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.module.ts index d1993885a14f..2c4bc05c64e6 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.module.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.module.ts @@ -1,7 +1,5 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { HttpModule } from '@angular/http'; <% if (routing) { %> import { AppRoutingModule } from './app-routing.module';<% } %> import { AppComponent } from './app.component'; @@ -11,9 +9,7 @@ import { AppComponent } from './app.component'; AppComponent ], imports: [ - BrowserModule, - FormsModule, - HttpModule<% if (routing) { %>, + BrowserModule<% if (routing) { %>, AppRoutingModule<% } %> ], providers: [], From 6ae3068f6faea85a7dac425d9a36f9c26b18e3d1 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Mon, 1 May 2017 15:41:58 -0400 Subject: [PATCH 4/5] feat(@angular/cli): updating landing page --- .../ng/files/__path__/app/app.component.html | 22 +++++++++++++--- .../files/__path__/app/app.component.spec.ts | 6 ++--- .../ng/files/__path__/app/app.component.ts | 2 +- .../blueprints/ng/files/e2e/app.e2e-spec.ts | 4 +-- tests/e2e/tests/build/assets.ts | 26 +++++++++++++++++-- 5 files changed, 49 insertions(+), 11 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html index 4b7217733e92..1ce8ba30aad3 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html @@ -1,4 +1,20 @@ -

- {{title}} -

<% if (routing) { %> +
+

+ Welcome to {{title}}!! +

+ +
+

Here are some links to help you start:

+ +<% if (routing) { %> <% } %> diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.spec.ts b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.spec.ts index 7f6fef4348cd..d61b4a947135 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.spec.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.spec.ts @@ -21,16 +21,16 @@ describe('AppComponent', () => { expect(app).toBeTruthy(); })); - it(`should have as title '<%= prefix %> works!'`, async(() => { + it(`should have as title '<%= prefix %>'`, async(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('<%= prefix %> works!'); + expect(app.title).toEqual('<%= prefix %>'); })); it('should render title in a h1 tag', async(() => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('<%= prefix %> works!'); + expect(compiled.querySelector('h1').textContent).toContain('Welcome to <%= prefix %>!!'); })); }); diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts index a0b31d8e11b6..018b5d5e6ba9 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts @@ -13,5 +13,5 @@ import { Component } from '@angular/core'; styleUrls: ['./app.component.<%= styleExt %>']<% } %> }) export class AppComponent { - title = '<%= prefix %> works!'; + title = '<%= prefix %>'; } diff --git a/packages/@angular/cli/blueprints/ng/files/e2e/app.e2e-spec.ts b/packages/@angular/cli/blueprints/ng/files/e2e/app.e2e-spec.ts index e427603edac4..cb0dc57d711d 100644 --- a/packages/@angular/cli/blueprints/ng/files/e2e/app.e2e-spec.ts +++ b/packages/@angular/cli/blueprints/ng/files/e2e/app.e2e-spec.ts @@ -7,8 +7,8 @@ describe('<%= htmlComponentName %> App', () => { page = new <%= jsComponentName %>Page(); }); - it('should display message saying app works', () => { + it('should display welcome message', () => { page.navigateTo(); - expect(page.getParagraphText()).toEqual('<%= prefix %> works!'); + expect(page.getParagraphText()).toEqual('Welcome to <%= prefix %>!!'); }); }); diff --git a/tests/e2e/tests/build/assets.ts b/tests/e2e/tests/build/assets.ts index e353d77351d9..0f434f39b761 100644 --- a/tests/e2e/tests/build/assets.ts +++ b/tests/e2e/tests/build/assets.ts @@ -49,6 +49,27 @@ export default function () { .then(() => expectToFail(() => expectFileToExist('dist/assets/.gitkeep'))) // Update app to test assets are present. .then(_ => !ejected && writeMultipleFiles({ + 'src/app/app.module.ts': ` + import { BrowserModule } from '@angular/platform-browser'; + import { NgModule } from '@angular/core'; + import { FormsModule } from '@angular/forms'; + import { HttpModule } from '@angular/http'; + import { AppComponent } from './app.component'; + + @NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + FormsModule, + HttpModule + ], + providers: [], + bootstrap: [AppComponent] + }) + export class AppModule { } + `, 'src/app/app.component.ts': ` import { Component } from '@angular/core'; import { Http, Response } from '@angular/http'; @@ -111,6 +132,7 @@ export default function () { }); });`, })) - .then(() => !ejected && ng('test', '--single-run')) - .then(() => !ejected && ng('e2e', '--no-progress')); + // .then(() => !ejected && ng('test', '--single-run')) + // .then(_ => killAllProcesses(), (err) => { killAllProcesses(); throw err; }) + .then(() => ng('e2e')); } From 4d4a4d725ce9405ee528b4b4e774deb1e6e2cfda Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Tue, 2 May 2017 11:52:03 -0400 Subject: [PATCH 5/5] test: fixing tests for landing page changes --- .../ng/files/__path__/app/app.component.html | 3 ++- tests/e2e/tests/build/assets.ts | 5 ++--- tests/e2e/tests/misc/default-port.ts | 2 +- tests/e2e/tests/misc/deploy-url.ts | 2 +- tests/e2e/tests/misc/fallback.ts | 4 ++-- tests/e2e/tests/misc/live-reload.ts | 20 +++++++++++++++++++ tests/e2e/tests/misc/ssl-default-config.ts | 2 +- tests/e2e/tests/misc/ssl-default.ts | 2 +- tests/e2e/tests/misc/ssl-with-cert-config.ts | 2 +- tests/e2e/tests/misc/ssl-with-cert.ts | 2 +- 10 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html index 1ce8ba30aad3..f72e0dc37c24 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.html @@ -1,8 +1,9 @@ +

Welcome to {{title}}!!

- +

Here are some links to help you start:

    diff --git a/tests/e2e/tests/build/assets.ts b/tests/e2e/tests/build/assets.ts index 0f434f39b761..ce15e48a81c0 100644 --- a/tests/e2e/tests/build/assets.ts +++ b/tests/e2e/tests/build/assets.ts @@ -132,7 +132,6 @@ export default function () { }); });`, })) - // .then(() => !ejected && ng('test', '--single-run')) - // .then(_ => killAllProcesses(), (err) => { killAllProcesses(); throw err; }) - .then(() => ng('e2e')); + .then(() => !ejected && ng('test', '--single-run')) + .then(() => !ejected && ng('e2e')); } diff --git a/tests/e2e/tests/misc/default-port.ts b/tests/e2e/tests/misc/default-port.ts index b525cf9867f0..8ab525c455d6 100644 --- a/tests/e2e/tests/misc/default-port.ts +++ b/tests/e2e/tests/misc/default-port.ts @@ -12,7 +12,7 @@ export default function() { .then(() => ngServe()) .then(() => request('http://localhost:4201/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/deploy-url.ts b/tests/e2e/tests/misc/deploy-url.ts index b43672e0eb84..929e982064f8 100644 --- a/tests/e2e/tests/misc/deploy-url.ts +++ b/tests/e2e/tests/misc/deploy-url.ts @@ -10,7 +10,7 @@ export default function () { .then(() => expectToFail(() => request('http://localhost:4200'))) .then(() => request('http://localhost:4200/deployurl')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/fallback.ts b/tests/e2e/tests/misc/fallback.ts index 12b27cf9d8d9..6c3cefe86864 100644 --- a/tests/e2e/tests/misc/fallback.ts +++ b/tests/e2e/tests/misc/fallback.ts @@ -11,7 +11,7 @@ export default function () { .then(() => ngServe()) .then(() => request('http://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) @@ -25,7 +25,7 @@ export default function () { .then(() => ngServe()) .then(() => request('http://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/live-reload.ts b/tests/e2e/tests/misc/live-reload.ts index e82b8c929a18..bcd2fa799c81 100644 --- a/tests/e2e/tests/misc/live-reload.ts +++ b/tests/e2e/tests/misc/live-reload.ts @@ -36,6 +36,26 @@ export default function () { return Promise.resolve() .then(_ => writeMultipleFiles({ + 'src/app/app.module.ts': ` + import { BrowserModule } from '@angular/platform-browser'; + import { NgModule } from '@angular/core'; + import { FormsModule } from '@angular/forms'; + import { HttpModule } from '@angular/http'; + import { AppComponent } from './app.component'; + @NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + FormsModule, + HttpModule + ], + providers: [], + bootstrap: [AppComponent] + }) + export class AppModule { } + `, // e2e test that just opens the page and waits, so that the app runs. './e2e/app.e2e-spec.ts': ` import { browser } from 'protractor'; diff --git a/tests/e2e/tests/misc/ssl-default-config.ts b/tests/e2e/tests/misc/ssl-default-config.ts index 94d134879999..6dc287a1dd50 100644 --- a/tests/e2e/tests/misc/ssl-default-config.ts +++ b/tests/e2e/tests/misc/ssl-default-config.ts @@ -12,7 +12,7 @@ export default function() { .then(() => ngServe()) .then(() => request('https://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/ssl-default.ts b/tests/e2e/tests/misc/ssl-default.ts index e16ec54291c9..80c3952b16ab 100644 --- a/tests/e2e/tests/misc/ssl-default.ts +++ b/tests/e2e/tests/misc/ssl-default.ts @@ -8,7 +8,7 @@ export default function() { .then(() => ngServe('--ssl', 'true')) .then(() => request('https://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/ssl-with-cert-config.ts b/tests/e2e/tests/misc/ssl-with-cert-config.ts index afb2e132c192..605c98726922 100644 --- a/tests/e2e/tests/misc/ssl-with-cert-config.ts +++ b/tests/e2e/tests/misc/ssl-with-cert-config.ts @@ -17,7 +17,7 @@ export default function() { .then(() => ngServe()) .then(() => request('https://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } }) diff --git a/tests/e2e/tests/misc/ssl-with-cert.ts b/tests/e2e/tests/misc/ssl-with-cert.ts index 3930c91625fb..e15aaed9d2b8 100644 --- a/tests/e2e/tests/misc/ssl-with-cert.ts +++ b/tests/e2e/tests/misc/ssl-with-cert.ts @@ -13,7 +13,7 @@ export default function() { )) .then(() => request('https://localhost:4200/')) .then(body => { - if (!body.match(/Loading...<\/app-root>/)) { + if (!body.match(/<\/app-root>/)) { throw new Error('Response does not match expected value.'); } })