fix(upgrade): fix bundling issue and fix e2e test

the previous demo app was broken and is missing an e2e test.

I fixed the app, but was not able to get protractor to properly test
this app. Julie and I are looking into that. For now I manually verified
that the app works and that the original issue was fixed.

Closes #9244
This commit is contained in:
Igor Minar 2016-06-16 09:56:14 -07:00
parent c5c456120c
commit 8c076d5a73
4 changed files with 25 additions and 6 deletions

View File

@ -9,13 +9,11 @@ export default {
'@angular/common': 'ng.common', '@angular/common': 'ng.common',
'@angular/compiler': 'ng.compiler', '@angular/compiler': 'ng.compiler',
'@angular/platform-browser': 'ng.platformBrowser', '@angular/platform-browser': 'ng.platformBrowser',
'@angular/platform-browser-dynamic': 'ng.platformBrowser.dynamic', '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
'rxjs/Subject': 'Rx', 'rxjs/Subject': 'Rx',
'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update.
'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/operator/toPromise': 'Rx.Observable.prototype',
'rxjs/Observable': 'Rx' 'rxjs/Observable': 'Rx'
}, },
plugins: [ plugins: []
// nodeResolve({ jsnext: true, main: true }),
]
} }

View File

@ -0,0 +1,19 @@
import {verifyNoBrowserErrors} from "@angular/platform-browser/testing_e2e";
// TODO(i): reenable once we fix issue with exposing testability to protractor when using ngUpgrade
// https://github.com/angular/angular/issues/9407
xdescribe('ngUpgrade', function() {
var URL = 'all/playground/src/upgrade/index.html';
beforeEach(function() { browser.get(URL); });
afterEach(verifyNoBrowserErrors);
it('should bootstrap Angular 1 and Angular 2 apps together', function() {
var ng1NameInput = element(by.css('input[ng-model]=name'));
expect(ng1NameInput.getAttribute('value')).toEqual('World');
var userSpan = element(by.css('user span'));
expect(userSpan.getText()).toMatch('/World$/');
});
});

View File

@ -12,7 +12,7 @@
</style> </style>
<body> <body>
<upgrade-app ng-controller="Index" [user]="name" (reset)="name=''"> <upgrade-app ng-controller="Index" [user]="name" (reset)="name=''">
Your name: <input ngModel="name"> Your name: <input ng-model="name">
<hr> <hr>
<span class="greeting">Greetings from {{name}}!</span> <span class="greeting">Greetings from {{name}}!</span>
</upgrade-app> </upgrade-app>

View File

@ -1,6 +1,8 @@
import {Component, Input, Output, EventEmitter} from '@angular/core'; import {Component, Input, Output, EventEmitter} from '@angular/core';
import {UpgradeAdapter} from '@angular/upgrade'; import {UpgradeAdapter} from '@angular/upgrade';
import * as angular from '@angular/upgrade/src/angular_js';
declare var angular: any;
var styles = [ var styles = [
` `