Skip to content

Commit f573a49

Browse files
committed
Add ngzone detection to fix tests as angular v21 is zoneless
1 parent 4a04f15 commit f573a49

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"to-string-loader": "^1.1.5",
7272
"tslib": "^2.6.2",
7373
"typescript": "^5.9.3",
74-
"webpack": "^5.95.0"
74+
"webpack": "^5.95.0",
75+
"zone.js": "~0.16.0"
7576
},
7677
"version": "9.1.2-rc",
7778
"name": "@tinymce/tinymce-angular",

tinymce-angular-component/src/test/ts/alien/InitTestEnvironment.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ import 'zone.js/plugins/fake-async-test';
44

55
import { TestBed } from '@angular/core/testing';
66
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
7+
import { NgModule, provideZoneChangeDetection } from '@angular/core';
78

8-
TestBed.initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
9-
teardown: { destroyAfterEach: true },
10-
});
9+
@NgModule({
10+
providers: [ provideZoneChangeDetection() ],
11+
})
12+
class AppTestingModule {}
13+
14+
TestBed.initTestEnvironment(
15+
[ BrowserTestingModule, AppTestingModule ], platformBrowserTesting(),
16+
{
17+
teardown: { destroyAfterEach: true },
18+
}
19+
);

tinymce-angular-component/src/test/ts/alien/TestHooks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
6969
fixture.detectChanges();
7070

7171
return firstValueFrom(
72+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7273
editorComponent.onInit.pipe(
7374
throwTimeout(10000, `Timed out waiting for editor to load`),
7475
switchMap(
@@ -79,10 +80,10 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
7980
// after global tinymce is removed in a clean up. Specifically, it happens when unloading/loading different versions of TinyMCE
8081
if (editor.licenseKeyManager) {
8182
editor.licenseKeyManager.validate({}).then(() => {
82-
resolve(editor);
83+
resolve(editor as Editor);
8384
}).catch((reason) => console.warn(reason));
8485
} else {
85-
resolve(editor);
86+
resolve(editor as Editor);
8687
}
8788
});
8889
})

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13914,3 +13914,8 @@ zone.js@~0.10.3:
1391413914
version "0.10.3"
1391513915
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.10.3.tgz#3e5e4da03c607c9dcd92e37dd35687a14a140c16"
1391613916
integrity sha512-LXVLVEq0NNOqK/fLJo3d0kfzd4sxwn2/h67/02pjCjfKDxgx1i9QqpvtHD8CrBnSSwMw5+dy11O7FRX5mkO7Cg==
13917+
13918+
zone.js@~0.16.0:
13919+
version "0.16.0"
13920+
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.16.0.tgz#955b9e28846d76ca2ef7091c8f9e96f35f79e828"
13921+
integrity sha512-LqLPpIQANebrlxY6jKcYKdgN5DTXyyHAKnnWWjE5pPfEQ4n7j5zn7mOEEpwNZVKGqx3kKKmvplEmoBrvpgROTA==

0 commit comments

Comments
 (0)