From 8c076d5a7394c5a9b3a5ac68b4e1ff1244a4a91f Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 16 Jun 2016 09:56:14 -0700 Subject: [PATCH] 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 --- modules/@angular/upgrade/rollup.config.js | 6 ++---- .../e2e_test/upgrade/upgrade_spec.ts | 19 +++++++++++++++++++ modules/playground/src/upgrade/index.html | 2 +- modules/playground/src/upgrade/index.ts | 4 +++- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 modules/playground/e2e_test/upgrade/upgrade_spec.ts diff --git a/modules/@angular/upgrade/rollup.config.js b/modules/@angular/upgrade/rollup.config.js index 014fbbb4fc..0b23f0fd5b 100644 --- a/modules/@angular/upgrade/rollup.config.js +++ b/modules/@angular/upgrade/rollup.config.js @@ -9,13 +9,11 @@ export default { '@angular/common': 'ng.common', '@angular/compiler': 'ng.compiler', '@angular/platform-browser': 'ng.platformBrowser', - '@angular/platform-browser-dynamic': 'ng.platformBrowser.dynamic', + '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic', '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/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/Observable': 'Rx' }, - plugins: [ -// nodeResolve({ jsnext: true, main: true }), - ] + plugins: [] } diff --git a/modules/playground/e2e_test/upgrade/upgrade_spec.ts b/modules/playground/e2e_test/upgrade/upgrade_spec.ts new file mode 100644 index 0000000000..98de255562 --- /dev/null +++ b/modules/playground/e2e_test/upgrade/upgrade_spec.ts @@ -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$/'); + }); +}); diff --git a/modules/playground/src/upgrade/index.html b/modules/playground/src/upgrade/index.html index 9b3d0f8cf7..499a7be8fa 100644 --- a/modules/playground/src/upgrade/index.html +++ b/modules/playground/src/upgrade/index.html @@ -12,7 +12,7 @@ - Your name: + Your name:
Greetings from {{name}}!
diff --git a/modules/playground/src/upgrade/index.ts b/modules/playground/src/upgrade/index.ts index 69ab973225..a806d09637 100644 --- a/modules/playground/src/upgrade/index.ts +++ b/modules/playground/src/upgrade/index.ts @@ -1,6 +1,8 @@ import {Component, Input, Output, EventEmitter} from '@angular/core'; import {UpgradeAdapter} from '@angular/upgrade'; -import * as angular from '@angular/upgrade/src/angular_js'; + +declare var angular: any; + var styles = [ `