fix(ng upgrade): do not compile ng2 components until after ng1 bootstrap (#10084)

Closes #9407 and angular/protractor#2944
This commit is contained in:
Sammy Jelin 2016-07-25 21:14:35 -07:00 committed by Miško Hevery
parent d15a1d64e1
commit 9edea0b139
2 changed files with 16 additions and 11 deletions

View File

@ -383,11 +383,8 @@ export class UpgradeAdapter {
}
});
Promise
.all([
this.compileNg2Components(compiler, componentFactoryRefMap), ng1BootstrapPromise,
ng1compilePromise
])
Promise.all([ng1BootstrapPromise, ng1compilePromise])
.then(() => { return this.compileNg2Components(compiler, componentFactoryRefMap); })
.then(() => {
ngZone.run(() => {
if (rootScopePrototype) {

View File

@ -8,20 +8,28 @@
import {verifyNoBrowserErrors} from "e2e_util/e2e_util";
// TODO(i): reenable once we fix issue with exposing testability to protractor when using ngUpgrade
// https://github.com/angular/angular/issues/9407
// TODO(i): reenable once we are using a version of protractor containing the
// change in https://github.com/angular/protractor/pull/3403
xdescribe('ngUpgrade', function() {
var URL = 'all/playground/src/upgrade/index.html';
beforeEach(function() { browser.get(URL); });
beforeEach(function() {
browser.rootEl = 'body';
(<any>browser).ng12Hybrid = true;
browser.get(URL);
});
afterEach(verifyNoBrowserErrors);
afterEach(function() {
(<any>browser).useAllAngular2AppRoots();
(<any>browser).ng12Hybrid = false;
verifyNoBrowserErrors();
});
it('should bootstrap Angular 1 and Angular 2 apps together', function() {
var ng1NameInput = element(by.css('input[ng-model]=name'));
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$/');
expect(userSpan.getText()).toMatch(/World$/);
});
});