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 Promise.all([ng1BootstrapPromise, ng1compilePromise])
.all([ .then(() => { return this.compileNg2Components(compiler, componentFactoryRefMap); })
this.compileNg2Components(compiler, componentFactoryRefMap), ng1BootstrapPromise,
ng1compilePromise
])
.then(() => { .then(() => {
ngZone.run(() => { ngZone.run(() => {
if (rootScopePrototype) { if (rootScopePrototype) {

View File

@ -8,20 +8,28 @@
import {verifyNoBrowserErrors} from "e2e_util/e2e_util"; import {verifyNoBrowserErrors} from "e2e_util/e2e_util";
// TODO(i): reenable once we fix issue with exposing testability to protractor when using ngUpgrade // TODO(i): reenable once we are using a version of protractor containing the
// https://github.com/angular/angular/issues/9407 // change in https://github.com/angular/protractor/pull/3403
xdescribe('ngUpgrade', function() { xdescribe('ngUpgrade', function() {
var URL = 'all/playground/src/upgrade/index.html'; 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() { 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'); expect(ng1NameInput.getAttribute('value')).toEqual('World');
var userSpan = element(by.css('user span')); var userSpan = element(by.css('user span'));
expect(userSpan.getText()).toMatch('/World$/'); expect(userSpan.getText()).toMatch(/World$/);
}); });
}); });