From 25e9cb7d32651a9f40590696375c72f6964cb75d Mon Sep 17 00:00:00 2001 From: Daniel Oakman <141111365+danoaky-tiny@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:35:50 +1000 Subject: [PATCH] INT-3297: Utilise majorVersion prop in LoadTinyTest.ts --- src/test/ts/alien/Loader.tsx | 4 ++-- src/test/ts/browser/LoadTinyTest.ts | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/test/ts/alien/Loader.tsx b/src/test/ts/alien/Loader.tsx index 004e1806..aaf73d4b 100644 --- a/src/test/ts/alien/Loader.tsx +++ b/src/test/ts/alien/Loader.tsx @@ -15,7 +15,7 @@ export interface Context { DOMNode: HTMLElement; editor: TinyMCEEditor; ref: React.RefObject; - version: string; + majorVersion: string; } const getRoot = () => Optional.from(document.getElementById('root')).getOrThunk(() => { @@ -69,7 +69,7 @@ export const render = async (props: Partial = {}, container: HTMLElem ref, editor, DOMNode, - version: Global.tinymce.majorVersion + majorVersion: Global.tinymce.majorVersion }); }); }, 0); diff --git a/src/test/ts/browser/LoadTinyTest.ts b/src/test/ts/browser/LoadTinyTest.ts index 308168d7..a9bf97db 100644 --- a/src/test/ts/browser/LoadTinyTest.ts +++ b/src/test/ts/browser/LoadTinyTest.ts @@ -3,45 +3,45 @@ import { describe, it } from '@ephox/bedrock-client'; import { Global } from '@ephox/katamari'; import { CLOUD_VERSIONS, VALID_API_KEY, VERSIONS, type Version } from '../alien/TestHelpers'; -import { render } from '../alien/Loader'; +import { render, ReactEditorContext } from '../alien/Loader'; -const assertTinymceVersion = (version: Version) => { - Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, Global.tinymce.majorVersion); +const assertTinymceVersion = (ctx: ReactEditorContext, version: Version) => { + Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, ctx.majorVersion); }; describe('LoadTinyTest', () => { VERSIONS.forEach((version) => { it(`Should be able to load local version (${version}) of TinyMCE using the tinymceScriptSrc prop`, async () => { - using _ctx = await render({ tinymceScriptSrc: `/project/node_modules/tinymce-${version}/tinymce.min.js`, licenseKey: 'gpl' }); - assertTinymceVersion(version); + using ctx = await render({ tinymceScriptSrc: `/project/node_modules/tinymce-${version}/tinymce.min.js`, licenseKey: 'gpl' }); + assertTinymceVersion(ctx, version); }); }); CLOUD_VERSIONS.forEach((version) => { it(`Should be able to load TinyMCE from Cloud (${version})`, async () => { const apiKey = 'a-fake-api-key'; - using _ctx = await render({ apiKey, cloudChannel: version }); - assertTinymceVersion(version); + using ctx = await render({ apiKey, cloudChannel: version }); + assertTinymceVersion(ctx, version); Assertions.assertEq( 'TinyMCE should have been loaded from Cloud', `https://cdn.tiny.cloud/1/${apiKey}/tinymce/${version}`, - Global.tinymce.baseURI.source + ctx.editor.baseURI.source ); }); it(`Should be able to load TinyMCE (${version}) in hybrid`, async () => { - using _ctx = await render({ + using ctx = await render({ tinymceScriptSrc: [ `/project/node_modules/tinymce-${version}/tinymce.min.js`, `https://cdn.tiny.cloud/1/${VALID_API_KEY}/tinymce/${version}/cloud-plugins.min.js?tinydrive=${version}` ], plugins: [ 'tinydrive' ] }); - assertTinymceVersion(version); + assertTinymceVersion(ctx, version); Assertions.assertEq( 'TinyMCE should have been loaded locally', `/project/node_modules/tinymce-${version}`, - Global.tinymce.baseURI.path + ctx.editor.baseURI.source ); Assertions.assertEq( 'The tinydrive plugin should have defaults for the cloud',