This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): Testapp with
@angular/upgrade/static
(ngUpgrade for A…
…oT apps) (#3758) These kids and their new fangled "ahead of time compilation." They're upgrading their apps using `@angular/upgrade/static` now. I guess we should get with the times and run tests against a webapp running this hip new API.
- Loading branch information
Showing
34 changed files
with
309 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,61 @@ | ||
describe('async angular1/2 hybrid using ngUpgrade application', function() { | ||
beforeEach(function() { | ||
browser.get('/hybrid'); | ||
}); | ||
describe('@angular/upgrade/static', function() { | ||
beforeEach(function() { | ||
browser.get('/upgrade'); | ||
}); | ||
|
||
it('should set browser flag via config', function() { | ||
expect(browser.ng12Hybrid).toBe(true); | ||
}); | ||
it('should set browser flag via config', function() { | ||
expect(browser.ng12Hybrid).toBe(true); | ||
}); | ||
|
||
it('should be able to click buttons and wait for $timeout', function() { | ||
var rootBtn = $$('my-app button').first(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 0'); | ||
rootBtn.click(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng2Btn = $$('ng2 button').first(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 0'); | ||
ng2Btn.click(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng1Btn = $('ng1 button'); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 0'); | ||
ng1Btn.click(); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 1'); | ||
}); | ||
|
||
it('should be able to click buttons and wait for $timeout', function() { | ||
var rootBtn = $$('my-app button').first(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 0'); | ||
rootBtn.click(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng2Btn = $$('ng2 button').first(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 0'); | ||
ng2Btn.click(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng1Btn = $('ng1 button'); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 0'); | ||
ng1Btn.click(); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 1'); | ||
it('should use the flag on the browser object', function() { | ||
browser.ng12Hybrid = false; | ||
browser.get('/ng2'); // will time out if Protractor expects hybrid | ||
browser.ng12Hybrid = true; | ||
}); | ||
}); | ||
|
||
it('should use the flag on the browser object', function() { | ||
browser.ng12Hybrid = false; | ||
browser.get('/ng2'); // will time out if Protractor expects hybrid | ||
browser.ng12Hybrid = true; | ||
describe('@angular/upgrade (not static)', function() { | ||
beforeEach(function() { | ||
browser.get('/upgrade?no_static'); | ||
}); | ||
|
||
it('should set browser flag via config', function() { | ||
expect(browser.ng12Hybrid).toBe(true); | ||
}); | ||
|
||
it('should be able to click buttons and wait for $timeout', function() { | ||
var rootBtn = $$('my-app button').first(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 0'); | ||
rootBtn.click(); | ||
expect(rootBtn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng2Btn = $$('ng2 button').first(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 0'); | ||
ng2Btn.click(); | ||
expect(ng2Btn.getText()).toEqual('Click Count: 1'); | ||
|
||
var ng1Btn = $('ng1 button'); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 0'); | ||
ng1Btn.click(); | ||
expect(ng1Btn.getText()).toEqual('Click Count: 1'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
import { UpgradeModule } from '@angular/upgrade/static'; | ||
|
||
import { AppModule } from './module'; | ||
|
||
platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => { | ||
const upgrade = platformRef.injector.get(UpgradeModule) as UpgradeModule; | ||
upgrade.bootstrap(document.body, ['upgradeApp'], {strictDi: true}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
declare var angular: angular.IAngularStatic; | ||
import { NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { UpgradeModule, downgradeComponent } from '@angular/upgrade/static'; | ||
|
||
import { RootDirective } from './myApp'; | ||
import { Ng2Component } from './ng2'; | ||
import { Ng1Directive, Ng1Component } from './ng1'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
BrowserModule, | ||
UpgradeModule | ||
], | ||
declarations: [ | ||
Ng2Component, | ||
Ng1Component, | ||
], | ||
entryComponents: [ | ||
Ng2Component | ||
] | ||
}) | ||
export class AppModule { | ||
ngDoBootstrap() {} | ||
} | ||
|
||
angular.module('upgradeApp', []) | ||
.directive('ng1', Ng1Directive) | ||
.directive('ng2', downgradeComponent({ | ||
component: Ng2Component, | ||
}) as angular.IDirectiveFactory) | ||
.directive('myApp', RootDirective); |
Oops, something went wrong.