Skip to content

Commit

Permalink
chore(testapp): upgrade to angular2 rc4 (angular#3304)
Browse files Browse the repository at this point in the history
* upgrade to angular2 rc4
* increase allScriptsTimeout and getPageTimeout for the angular 2 test
  • Loading branch information
cnishina authored Jul 1, 2016
1 parent e786ea1 commit 23aabb8
Show file tree
Hide file tree
Showing 27 changed files with 189 additions and 111 deletions.
2 changes: 1 addition & 1 deletion scripts/test_on_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ elif [ $JOB = "full" ]; then
node bin/protractor spec/ciFullConf.js
if [ $? = "0" ]; then
node bin/protractor spec/ciNg2Conf.js
else
else
exit 1
fi
elif [ $JOB = "bstack" ]; then
Expand Down
7 changes: 6 additions & 1 deletion spec/angular2Conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ exports.config = {
// on the page. This means that Protractor will wait for every app to be
// stable before each action, and search within all apps when finding
// elements.
useAllAngular2AppRoots: true
useAllAngular2AppRoots: true,

// Alternatively, you could specify one root element application, to test
// against only that one:
// rootElement: 'async-app'
allScriptsTimeout: 120000,
getPageTimeout: 120000,
jasmineNodeOpts: {
defaultTimeoutInterval: 120000
}
};
1 change: 1 addition & 0 deletions testapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js.map
2 changes: 1 addition & 1 deletion testapp/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" ng-app="myApp">
<html lang="en">
<head>
<meta charset="utf-8">
<title>My AngularJS App</title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="container">
<h1 class="title">Test App for Angular 2</h1>
<nav class="nav">
<a [routerLink]="['Home']">home</a>
<a [routerLink]="['Async']">async</a>
<a [routerLink]="['/']">home</a>
<a [routerLink]="['/async']">async</a>
</nav>
<router-outlet></router-outlet>
</div>
34 changes: 12 additions & 22 deletions testapp/ng2/app/app.router.js → testapp/ng2/app/app.component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions testapp/ng2/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { ROUTER_DIRECTIVES } from '@angular/router';

@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
directives: [ ROUTER_DIRECTIVES ]
})
export class AppComponent {

}
1 change: 0 additions & 1 deletion testapp/ng2/app/app.router.js.map

This file was deleted.

17 changes: 0 additions & 17 deletions testapp/ng2/app/app.router.ts

This file was deleted.

28 changes: 28 additions & 0 deletions testapp/ng2/app/app.routes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions testapp/ng2/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { provideRouter, RouterConfig } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { AsyncComponent } from './async/async.component';

export const routes: RouterConfig = [
{ path: '', component: HomeComponent },
{ path: 'async', component: AsyncComponent }
];

export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
]
File renamed without changes.
4 changes: 2 additions & 2 deletions testapp/ng2/app/async/async.component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion testapp/ng2/app/async/async.component.js.map

This file was deleted.

7 changes: 3 additions & 4 deletions testapp/ng2/app/async/async.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {bootstrap} from 'angular2/bootstrap';
import {Component, NgZone} from 'angular2/core';
import {NgIf} from 'angular2/common';
import { Component, NgZone } from '@angular/core';
import { NgIf } from '@angular/common';

@Component({
templateUrl: 'app/async/async-component.html',
templateUrl: 'app/async/async.component.html',
directives: [NgIf]
})
export class AsyncComponent {
Expand Down
24 changes: 0 additions & 24 deletions testapp/ng2/app/boot.js

This file was deleted.

1 change: 0 additions & 1 deletion testapp/ng2/app/boot.js.map

This file was deleted.

7 changes: 0 additions & 7 deletions testapp/ng2/app/boot.ts

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions testapp/ng2/app/home/home.component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions testapp/ng2/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Component} from 'angular2/core';
import { Component } from '@angular/core';

@Component({
templateUrl: 'app/home/home-component.html'
templateUrl: 'app/home/home.component.html'
})
export class HomeComponent {

}
31 changes: 31 additions & 0 deletions testapp/ng2/app/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions testapp/ng2/app/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { bootstrap } from '@angular/platform-browser-dynamic';
import { provide } from '@angular/core';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { AppComponent } from './app.component';
import { APP_ROUTER_PROVIDERS } from './app.routes';

bootstrap(AppComponent, [
APP_ROUTER_PROVIDERS,
provide(LocationStrategy, {useClass: HashLocationStrategy})
])
.catch(err => console.error(err));
25 changes: 10 additions & 15 deletions testapp/ng2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,400italic,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="styles.css">
<!-- IE required polyfills, in this exact order -->
<script src="../node_modules/es6-shim/es6-shim.min.js"></script>
<script src="../node_modules/core-js/client/shim.min.js"></script>
<script src="../node_modules/reflect-metadata/Reflect.js"></script>
<script src="../node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="../node_modules/systemjs/dist/system.js"></script>
<script src="../node_modules/typescript/lib/typescript.js"></script>
<script src="../node_modules/rxjs/bundles/Rx.js"></script>
<script src="../node_modules/angular2/bundles/angular2.dev.js"></script>

<!-- Add the router library -->
<script src="../node_modules/angular2/bundles/router.js"></script>
<script src="../node_modules/systemjs/dist/system.src.js"></script>
<script src="../node_modules/zone.js/dist/zone.js"></script>

<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true },
packages: {'app': {defaultExtension: 'ts'}}
System.import('system-config.js').then(function() {
System.import('app/main');
}).catch(function(err) {
console.log('error while importing');
console.log(err);
console.log(err.stack);
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</head>

Expand Down
39 changes: 39 additions & 0 deletions testapp/ng2/system-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
System.config({
map: {
'rxjs': '/node_modules/rxjs',
'@angular': '/node_modules/@angular'
},
packages: {
'app': {
main: 'boot.js',
defaultExtension: 'js'
},
'@angular/core': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/router': {
main: 'index.js',
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
}
}
});
Loading

0 comments on commit 23aabb8

Please sign in to comment.