convert 1-2-hybrid-bootstrap to upgrade/static
This commit is contained in:
parent
b0ca4f5040
commit
e990594b6d
|
@ -35,6 +35,11 @@ export function waitForNg1AsyncBootstrap() {
|
|||
browser.driver.wait(function() {
|
||||
return element(by.css('.ng-scope')).isPresent();
|
||||
}, 5000);
|
||||
// Use this instead when upgrading to protractor > 4.0.10
|
||||
// browser.ng12Hybrid = true;
|
||||
}
|
||||
|
||||
export function setProtractorToHybridMode() {
|
||||
setProtractorToNg1Mode();
|
||||
browser.ng12Hybrid = true;
|
||||
// remove once waitForNg1AsyncBootstrap() is removed as well
|
||||
browser.ignoreSynchronization = false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'; // necessary for es6 output in node
|
||||
|
||||
import { browser, element, by } from 'protractor';
|
||||
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap } from '../protractor-helpers';
|
||||
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap, setProtractorToHybridMode } from '../protractor-helpers';
|
||||
|
||||
describe('Upgrade Tests', function () {
|
||||
|
||||
|
@ -35,9 +35,8 @@ describe('Upgrade Tests', function () {
|
|||
describe('NG1-2 Hybrid Bootstrap', function() {
|
||||
|
||||
beforeAll(function () {
|
||||
setProtractorToHybridMode();
|
||||
browser.get('/index-1-2-hybrid-bootstrap.html');
|
||||
setProtractorToNg1Mode();
|
||||
waitForNg1AsyncBootstrap();
|
||||
});
|
||||
|
||||
it('bootstraps as expected', function () {
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
declare var angular: any;
|
||||
// #docregion ngmodule
|
||||
import { NgModule } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { UpgradeModule } from '@angular/upgrade/static';
|
||||
|
||||
@NgModule({
|
||||
imports: [ BrowserModule ]
|
||||
imports: [
|
||||
BrowserModule,
|
||||
UpgradeModule
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
export class AppModule {
|
||||
ngDoBootstrap() {}
|
||||
}
|
||||
// #enddocregion ngmodule
|
||||
angular.module('heroApp', [])
|
||||
.controller('MainCtrl', function() {
|
||||
this.message = 'Hello world';
|
||||
});
|
||||
|
||||
|
||||
// #docregion bootstrap
|
||||
import { UpgradeAdapter } from '@angular/upgrade';
|
||||
|
||||
// #enddocregion bootstrap
|
||||
|
||||
// This blank is expected to trigger the docplaster
|
||||
|
||||
// #docregion bootstrap
|
||||
|
||||
const upgradeAdapter = new UpgradeAdapter(AppModule);
|
||||
|
||||
upgradeAdapter.bootstrap(document.body, ['heroApp'], {strictDi: true});
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
|
||||
let upgrade = platformRef.injector.get(UpgradeModule);
|
||||
upgrade.bootstrap(document.body, ['heroApp'], {strictDi: true});
|
||||
});
|
||||
// #enddocregion bootstrap
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script src="systemjs.config.extras.js"></script>
|
||||
<script>
|
||||
System.import('app/1-2-hybrid-bootstrap/app.module')
|
||||
.then(null, console.error.bind(console));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script src="systemjs.config.extras.js"></script>
|
||||
<script>
|
||||
System.import('app/upgrade-static/app.module')
|
||||
.then(null, console.error.bind(console));
|
||||
|
|
Loading…
Reference in New Issue