Skip to content

Commit 9edea0b

Browse files
sjelinmhevery
authored andcommitted
fix(ng upgrade): do not compile ng2 components until after ng1 bootstrap (angular#10084)
Closes angular#9407 and angular/protractor#2944
1 parent d15a1d6 commit 9edea0b

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

modules/@angular/upgrade/src/upgrade_adapter.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,8 @@ export class UpgradeAdapter {
383383
}
384384
});
385385

386-
Promise
387-
.all([
388-
this.compileNg2Components(compiler, componentFactoryRefMap), ng1BootstrapPromise,
389-
ng1compilePromise
390-
])
386+
Promise.all([ng1BootstrapPromise, ng1compilePromise])
387+
.then(() => { return this.compileNg2Components(compiler, componentFactoryRefMap); })
391388
.then(() => {
392389
ngZone.run(() => {
393390
if (rootScopePrototype) {

modules/playground/e2e_test/upgrade/upgrade_spec.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,28 @@
88

99
import {verifyNoBrowserErrors} from "e2e_util/e2e_util";
1010

11-
// TODO(i): reenable once we fix issue with exposing testability to protractor when using ngUpgrade
12-
// https://github.com/angular/angular/issues/9407
11+
// TODO(i): reenable once we are using a version of protractor containing the
12+
// change in https://github.com/angular/protractor/pull/3403
1313
xdescribe('ngUpgrade', function() {
1414
var URL = 'all/playground/src/upgrade/index.html';
1515

16-
beforeEach(function() { browser.get(URL); });
16+
beforeEach(function() {
17+
browser.rootEl = 'body';
18+
(<any>browser).ng12Hybrid = true;
19+
browser.get(URL);
20+
});
1721

18-
afterEach(verifyNoBrowserErrors);
22+
afterEach(function() {
23+
(<any>browser).useAllAngular2AppRoots();
24+
(<any>browser).ng12Hybrid = false;
25+
verifyNoBrowserErrors();
26+
});
1927

2028
it('should bootstrap Angular 1 and Angular 2 apps together', function() {
21-
var ng1NameInput = element(by.css('input[ng-model]=name'));
29+
var ng1NameInput = element(by.css('input[ng-model="name"]'));
2230
expect(ng1NameInput.getAttribute('value')).toEqual('World');
2331

2432
var userSpan = element(by.css('user span'));
25-
expect(userSpan.getText()).toMatch('/World$/');
33+
expect(userSpan.getText()).toMatch(/World$/);
2634
});
2735
});

0 commit comments

Comments
 (0)