feat(core): support for bootstrap with custom zone (#17672)

PR Close #17672
This commit is contained in:
Miško Hevery
2017-06-01 14:45:49 -07:00
committed by Igor Minar
parent 6e1896b333
commit 344a5ca545
7 changed files with 123 additions and 35 deletions

View File

@ -6,11 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {EventEmitter, NgZone} from '@angular/core';
import {async, fakeAsync, flushMicrotasks} from '@angular/core/testing';
import {AsyncTestCompleter, Log, beforeEach, describe, expect, inject, it, xit} from '@angular/core/testing/src/testing_internal';
import {browserDetection} from '@angular/platform-browser/testing/src/browser_util';
import {scheduleMicroTask} from '../../src/util';
import {NoopNgZone} from '../../src/zone/ng_zone';
const needsLongerTimers = browserDetection.isSlow || browserDetection.isEdge;
const resultTimer = 1000;
@ -170,6 +171,25 @@ export function main() {
}), testTimeout);
});
});
describe('NoopNgZone', () => {
const ngZone = new NoopNgZone();
it('should run', () => {
let runs = false;
ngZone.run(() => {
ngZone.runGuarded(() => { ngZone.runOutsideAngular(() => { runs = true; }); });
});
expect(runs).toBe(true);
});
it('should have EventEmitter instances', () => {
expect(ngZone.onError instanceof EventEmitter).toBe(true);
expect(ngZone.onStable instanceof EventEmitter).toBe(true);
expect(ngZone.onUnstable instanceof EventEmitter).toBe(true);
expect(ngZone.onMicrotaskEmpty instanceof EventEmitter).toBe(true);
});
});
}
function commonTests() {