/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {NgModule, Testability, destroyPlatform} from '@angular/core'; import {NgZone} from '@angular/core/src/zone/ng_zone'; import {fakeAsync, tick} from '@angular/core/testing'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import * as angular from '@angular/upgrade/src/common/angular1'; import {UpgradeModule} from '@angular/upgrade/static'; import {bootstrap, html} from '../test_helpers'; export function main() { describe('testability', () => { beforeEach(() => destroyPlatform()); afterEach(() => destroyPlatform()); @NgModule({imports: [BrowserModule, UpgradeModule]}) class Ng2Module { ngDoBootstrap() {} } it('should handle deferred bootstrap', fakeAsync(() => { let applicationRunning = false; let stayedInTheZone: boolean; const ng1Module = angular.module('ng1', []).run(() => { applicationRunning = true; stayedInTheZone = NgZone.isInAngularZone(); }); const element = html('
'); window.name = 'NG_DEFER_BOOTSTRAP!' + window.name; bootstrap(platformBrowserDynamic(), Ng2Module, element, ng1Module); setTimeout(() => { (