Skip to content

Commit 4342897

Browse files
committed
Fix failing tests due to race conditions
1 parent fdbcb01 commit 4342897

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const editorHook = <T = unknown>(component: Type<T>, moduleDef: TestModul
7777
if (editor.initialized) {
7878
resolve(editor);
7979
}
80-
editor.once('SkinLoaded', () => resolve(editor));
80+
editor.once( 'init', () => resolve(editor));
8181
})
8282
),
8383
map(

tinymce-angular-component/src/test/ts/browser/LoadTinyTest.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { EditorComponent, TINYMCE_SCRIPT_SRC } from '../../../main/ts/public_api
88
import { Version } from '../../../main/ts/editor/editor.component';
99
import { editorHook, tinymceVersionHook } from '../alien/TestHooks';
1010
import type { Editor } from 'tinymce';
11-
import { deleteTinymce } from '../alien/TestHelpers';
11+
import { apiKey, deleteTinymce } from '../alien/TestHelpers';
1212

1313
describe('LoadTinyTest', () => {
14+
const key = apiKey();
1415
const assertTinymceVersion = (version: Version, editor: Editor) => {
1516
Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, editor.editorManager.majorVersion);
1617
Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, Global.tinymce.majorVersion);
@@ -46,19 +47,18 @@ describe('LoadTinyTest', () => {
4647
});
4748
}
4849

49-
for (const version of [ '5', '6', '7', '8' ] as Version[]) {
50+
for (const version of [ '4', '5', '6', '7', '8' ] as Version[]) {
5051
context(`With cloud version ${version}`, () => {
5152
const createFixture = editorHook(EditorComponent);
5253

5354
before(deleteTinymce);
5455

5556
it(`Should be able to load TinyMCE ${version} from Cloud`, async () => {
56-
const apiKey = 'fake-api-key';
57-
const { editor } = await createFixture({ cloudChannel: version, apiKey });
57+
const { editor } = await createFixture({ cloudChannel: version, apiKey: key });
5858
assertTinymceVersion(version, editor);
5959
Assertions.assertEq(
6060
'TinyMCE should have been loaded from Cloud',
61-
`https://cdn.tiny.cloud/1/${apiKey}/tinymce/${version}`,
61+
`https://cdn.tiny.cloud/1/${key}/tinymce/${version}`,
6262
Global.tinymce.baseURI.source
6363
);
6464
});

0 commit comments

Comments
 (0)