11import '../alien/InitTestEnvironment' ;
22
3- import { NgZone } from '@angular/core' ;
3+ import { NgZone , provideZoneChangeDetection } from '@angular/core' ;
44import { Assertions } from '@ephox/agar' ;
5- import { describe , it } from '@ephox/bedrock-client' ;
5+ import { beforeEach , describe , it } from '@ephox/bedrock-client' ;
66
77import { EditorComponent } from '../../../main/ts/editor/editor.component' ;
8- import { eachVersionContext , fixtureHook } from '../alien/TestHooks' ;
8+ import { eachVersionContext } from '../alien/TestHooks' ;
99import { first } from 'rxjs' ;
1010import { throwTimeout } from '../alien/TestHelpers' ;
11+ import { TestBed } from '@angular/core/testing' ;
1112
12- describe . skip ( 'NgZoneTest' , ( ) => {
13+ describe ( 'NgZoneTest' , ( ) => {
1314 eachVersionContext ( [ '4' , '5' , '6' , '7' , '8' ] , ( ) => {
14- const createFixture = fixtureHook ( EditorComponent , { imports : [ EditorComponent ] } ) ;
15+ beforeEach ( async ( ) => {
16+ await TestBed . configureTestingModule ( {
17+ imports : [ EditorComponent ] ,
18+ providers : [ provideZoneChangeDetection ( ) ]
19+ } ) . compileComponents ( ) ;
20+ } ) ;
1521
1622 it ( 'Subscribers to events should run within NgZone' , async ( ) => {
17- const fixture = createFixture ( ) ;
23+ const fixture = TestBed . createComponent ( EditorComponent ) ;
1824 const editor = fixture . componentInstance ;
1925 fixture . detectChanges ( ) ;
26+
2027 await new Promise < void > ( ( resolve ) => {
2128 editor . onInit . pipe ( first ( ) , throwTimeout ( 10000 , 'Timed out waiting for init event' ) ) . subscribe ( ( ) => {
2229 Assertions . assertEq ( 'Subscribers to onInit should run within NgZone' , true , NgZone . isInAngularZone ( ) ) ;
@@ -27,9 +34,10 @@ describe.skip('NgZoneTest', () => {
2734
2835 // Lets just test one EventEmitter, if one works all should work
2936 it ( 'Subscribers to onKeyUp should run within NgZone' , async ( ) => {
30- const fixture = createFixture ( ) ;
37+ const fixture = TestBed . createComponent ( EditorComponent ) ;
3138 const editor = fixture . componentInstance ;
3239 fixture . detectChanges ( ) ;
40+
3341 await new Promise < void > ( ( resolve ) => {
3442 editor . onKeyUp . pipe ( first ( ) , throwTimeout ( 10000 , 'Timed out waiting for key up event' ) ) . subscribe ( ( ) => {
3543 Assertions . assertEq ( 'Subscribers to onKeyUp should run within NgZone' , true , NgZone . isInAngularZone ( ) ) ;
0 commit comments