OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
test
/
ts
/
browser
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:15:06 AM
rwxr-xr-x
📄
AddOnManagerTest.ts
2.71 KB
02/20/2020 05:44:53 AM
rw-r--r--
📄
ClickContentEditableFalseTest.ts
3.13 KB
02/20/2020 05:44:53 AM
rw-r--r--
📄
DragDropOverridesTest.ts
1.55 KB
02/20/2020 05:44:54 AM
rw-r--r--
📄
EditorForcedSettingsTest.ts
904 bytes
02/20/2020 05:44:54 AM
rw-r--r--
📄
EditorManagerTest.ts
7.41 KB
02/20/2020 05:44:55 AM
rw-r--r--
📄
EditorRemoveTest.ts
2.58 KB
02/20/2020 05:44:56 AM
rw-r--r--
📄
EditorRemovedApiTest.ts
2.98 KB
02/20/2020 05:44:55 AM
rw-r--r--
📄
EditorRtlTest.ts
1.39 KB
02/20/2020 05:44:56 AM
rw-r--r--
📄
EditorSettingsTest.ts
14.57 KB
02/20/2020 05:44:57 AM
rw-r--r--
📄
EditorTest.ts
15.89 KB
02/20/2020 05:44:57 AM
rw-r--r--
📄
EditorUploadTest.ts
11.16 KB
02/20/2020 05:44:58 AM
rw-r--r--
📄
EditorViewIframeTest.ts
3.35 KB
02/20/2020 05:44:58 AM
rw-r--r--
📄
EditorViewInlineTest.ts
3.25 KB
02/20/2020 05:44:59 AM
rw-r--r--
📄
FontSelectTest.ts
4.79 KB
02/20/2020 05:44:59 AM
rw-r--r--
📄
ForceBlocksTest.ts
4.89 KB
02/20/2020 05:45:00 AM
rw-r--r--
📄
FormatterApplyTest.ts
83.91 KB
02/20/2020 05:45:00 AM
rw-r--r--
📄
FormatterCheckTest.ts
10.05 KB
02/20/2020 05:45:01 AM
rw-r--r--
📄
FormatterRemoveTest.ts
24.06 KB
02/20/2020 05:45:01 AM
rw-r--r--
📄
FormattingCommandsTest.ts
19.5 KB
02/20/2020 05:45:02 AM
rw-r--r--
📄
InlineEditorRemoveTest.ts
1.17 KB
02/20/2020 05:45:03 AM
rw-r--r--
📄
InlineEditorSaveTest.ts
1.19 KB
02/20/2020 05:45:03 AM
rw-r--r--
📄
JqueryIntegrationTest.disabled
4.5 KB
02/20/2020 05:45:04 AM
rw-r--r--
📄
MiscCommandsTest.ts
3.61 KB
02/20/2020 05:45:05 AM
rw-r--r--
📄
ModeTest.ts
4.18 KB
02/20/2020 05:45:05 AM
rw-r--r--
📄
NotificationManagerTest.ts
4.01 KB
02/20/2020 05:45:06 AM
rw-r--r--
📄
SelectionOverridesTest.ts
10.48 KB
02/20/2020 05:45:06 AM
rw-r--r--
📄
ShortcutsTest.ts
3.67 KB
02/20/2020 05:45:07 AM
rw-r--r--
📄
UndoManagerTest.ts
14.65 KB
02/20/2020 05:45:07 AM
rw-r--r--
📄
WindowManagerTest.ts
1.29 KB
02/20/2020 05:45:08 AM
rw-r--r--
📁
annotate
-
02/20/2020 06:12:41 AM
rwxr-xr-x
📁
api
-
02/20/2020 06:34:15 AM
rwxr-xr-x
📁
bookmark
-
02/20/2020 06:12:48 AM
rwxr-xr-x
📁
caret
-
02/20/2020 06:12:58 AM
rwxr-xr-x
📁
commands
-
02/20/2020 06:13:03 AM
rwxr-xr-x
📁
content
-
02/20/2020 06:13:08 AM
rwxr-xr-x
📁
delete
-
02/20/2020 06:13:20 AM
rwxr-xr-x
📁
dom
-
02/20/2020 06:13:35 AM
rwxr-xr-x
📁
file
-
02/20/2020 06:13:40 AM
rwxr-xr-x
📁
fmt
-
02/20/2020 06:13:49 AM
rwxr-xr-x
📁
focus
-
02/20/2020 06:13:55 AM
rwxr-xr-x
📁
geom
-
02/20/2020 06:13:59 AM
rwxr-xr-x
📁
html
-
02/20/2020 06:14:06 AM
rwxr-xr-x
📁
init
-
02/20/2020 06:14:16 AM
rwxr-xr-x
📁
keyboard
-
02/20/2020 06:14:32 AM
rwxr-xr-x
📁
newline
-
02/20/2020 06:14:36 AM
rwxr-xr-x
📁
selection
-
02/20/2020 06:14:47 AM
rwxr-xr-x
📁
undo
-
02/20/2020 06:14:53 AM
rwxr-xr-x
📁
util
-
02/20/2020 06:15:03 AM
rwxr-xr-x
Editing: EditorSettingsTest.ts
Close
import { Assertions, GeneralSteps, Logger, Pipeline, Step } from '@ephox/agar'; import { TinyLoader } from '@ephox/mcagar'; import { PlatformDetection } from '@ephox/sand'; import * as EditorSettings from 'tinymce/core/EditorSettings'; import Theme from 'tinymce/themes/silver/Theme'; import { UnitTest } from '@ephox/bedrock'; import Editor from 'tinymce/core/api/Editor'; import EditorManager from 'tinymce/core/api/EditorManager'; UnitTest.asynctest('browser.tinymce.core.EditorSettingsTest', function () { const success = arguments[arguments.length - 2]; const failure = arguments[arguments.length - 1]; const detection = PlatformDetection.detect(); const isTouch = detection.deviceType.isTouch(); const isiPhone = detection.deviceType.isiPhone(); Theme(); TinyLoader.setup(function (editor, onSuccess, onFailure) { Pipeline.async({}, [ Logger.t('getEditorSettings tests', GeneralSteps.sequence([ Logger.t('Override defaults plugins', Step.sync(function () { const settings = EditorSettings.getEditorSettings( editor, 'id', 'documentBaseUrl', { defaultSetting: 'a', plugins: ['a'] }, { validate: false, userSetting: 'b' } ); Assertions.assertEq('Should have the specified id', 'id', settings.id); Assertions.assertEq('Should have the specified documentBaseUrl', 'documentBaseUrl', settings.document_base_url); Assertions.assertEq('Should have the specified userSetting', 'b', settings.userSetting); Assertions.assertEq('Should have the forced validate setting', true, settings.validate); Assertions.assertEq('Should have the default theme', 'silver', settings.theme); Assertions.assertEq('Should have the specified default plugin', 'a', settings.plugins); Assertions.assertEq('Should have the default setting', 'a', settings.defaultSetting); })), Logger.t('Override defaults with forced_plugins using arrays', Step.sync(function () { const defaultSettings = { forced_plugins: ['a', 'b'] }; const userSettings = { plugins: ['c', 'd'] }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be both forced and user plugins', 'a b c d', settings.plugins); })), Logger.t('Override defaults with forced_plugins using strings', Step.sync(function () { const defaultSettings = { forced_plugins: 'a b' }; const userSettings = { plugins: 'c d' }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be both forced and user plugins', 'a b c d', settings.plugins); })), Logger.t('Override defaults with forced_plugins using mixed types and spaces', Step.sync(function () { const defaultSettings = { forced_plugins: ' a b' }; const userSettings = { plugins: [' c ', ' d e '] }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be both forced and user plugins', 'a b c d e', settings.plugins); })), Logger.t('Override defaults with just default forced_plugins', Step.sync(function () { const defaultSettings = { forced_plugins: ['a', 'b'] }; const userSettings = { }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be just default plugins', 'a b', settings.plugins); })), Logger.t('Override defaults with just user plugins', Step.sync(function () { const defaultSettings = { }; const userSettings = { plugins: ['a', 'b'] }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be just user plugins', 'a b', settings.plugins); })), Logger.t('Override defaults with forced_plugins should not be possible to override', Step.sync(function () { const defaultSettings = { forced_plugins: ['a', 'b'] }; const userSettings = { forced_plugins: ['a'], plugins: ['c', 'd'] }; const settings = EditorSettings.getEditorSettings(editor, 'id', 'documentBaseUrl', defaultSettings, userSettings); Assertions.assertEq('Should be just forced and user plugins', 'a b c d', settings.plugins); })), Logger.t('Getters for varous setting types', Step.sync(function () { const settings = EditorSettings.getEditorSettings( {} as Editor, 'id', 'documentBaseUrl', { plugins: ['a'] }, { string: 'a', number: 1, boolTrue: true, boolFalse: false, null: null, undef: undefined } ); const fakeEditor = { settings } as Editor; Assertions.assertEq('Should be none for non existing setting', true, EditorSettings.get(fakeEditor, 'non_existing').isNone()); Assertions.assertEq('Should be none for existing null setting', true, EditorSettings.get(fakeEditor, 'non_existing').isNone()); Assertions.assertEq('Should be none for existing undefined setting', true, EditorSettings.get(fakeEditor, 'undef').isNone()); Assertions.assertEq('Should be some for existing string setting', 'a', EditorSettings.get(fakeEditor, 'string').getOrDie()); Assertions.assertEq('Should be some for existing number setting', 1, EditorSettings.get(fakeEditor, 'number').getOrDie()); Assertions.assertEq('Should be some for existing bool setting', true, EditorSettings.get(fakeEditor, 'boolTrue').getOrDie()); Assertions.assertEq('Should be some for existing bool setting', false, EditorSettings.get(fakeEditor, 'boolFalse').getOrDie()); Assertions.assertEq('Should be none for non existing setting', true, EditorSettings.getString(fakeEditor, 'non_existing').isNone()); Assertions.assertEq('Should be some for existing string setting', 'a', EditorSettings.getString(fakeEditor, 'string').getOrDie()); Assertions.assertEq('Should be none for existing number setting', true, EditorSettings.getString(fakeEditor, 'number').isNone()); Assertions.assertEq('Should be none for existing bool setting', true, EditorSettings.getString(fakeEditor, 'boolTrue').isNone()); })), Logger.t('Mobile override', Step.sync(function () { const settings = EditorSettings.getEditorSettings( {} as Editor, 'id', 'documentBaseUrl', { settingB: false }, { mobile: { settingA: true, settingB: true } } ); const fakeEditor = { settings } as Editor; Assertions.assertEq('Should only have the mobile setting on touch', EditorSettings.get(fakeEditor, 'settingA').getOr(false), isTouch); Assertions.assertEq('Should not have a mobile setting on desktop', EditorSettings.get(fakeEditor, 'settingA').isNone(), !isTouch); Assertions.assertEq('Should have the expected mobile setting value on touch', EditorSettings.get(fakeEditor, 'settingB').getOr(false), isTouch); Assertions.assertEq('Should have the expected desktop setting on desktop', EditorSettings.get(fakeEditor, 'settingB').getOr(true), isTouch); })) ])), Logger.t('combineSettings tests', GeneralSteps.sequence([ Logger.t('Merged settings (desktop)', Step.sync(function () { Assertions.assertEq( 'Should be have validate forced and empty plugins the merged settings', { a: 1, b: 2, c: 3, validate: true, external_plugins: {}, plugins: '' }, EditorSettings.combineSettings(false, { a: 1, b: 1, c: 1 }, { b: 2 }, { c: 3 }) ); })), Logger.t('Merged settings forced_plugins in default override settings (desktop)', Step.sync(function () { Assertions.assertEq( 'Should be have plugins merged with forced plugins', { validate: true, external_plugins: {}, forced_plugins: ['a'], plugins: 'a b' }, EditorSettings.combineSettings(false, {}, { forced_plugins: ['a'] }, { plugins: ['b'] }) ); })), Logger.t('Merged settings (mobile)', Step.sync(function () { Assertions.assertEq( 'Should be have validate forced and empty plugins the merged settings', { a: 1, b: 2, c: 3, validate: true, external_plugins: {}, plugins: '' }, EditorSettings.combineSettings(true, { a: 1, b: 1, c: 1 }, { b: 2 }, { c: 3 }) ); })), Logger.t('Merged settings forced_plugins in default override settings (mobile)', Step.sync(function () { Assertions.assertEq( 'Should be have plugins merged with forced plugins', { validate: true, external_plugins: {}, forced_plugins: ['a'], plugins: 'a b' }, EditorSettings.combineSettings(true, {}, { forced_plugins: ['a'] }, { plugins: ['b'] }) ); })), Logger.t('Merged settings forced_plugins in default override settings with user mobile settings (desktop)', Step.sync(function () { Assertions.assertEq( 'Should not have plugins merged with mobile plugins', { validate: true, external_plugins: {}, forced_plugins: ['a'], plugins: 'a b' }, EditorSettings.combineSettings(false, {}, { forced_plugins: ['a'] }, { plugins: ['b'], mobile: { plugins: ['c'] } }) ); })), Logger.t('Merged settings forced_plugins in default override settings with user mobile settings (mobile)', Step.sync(function () { Assertions.assertEq( 'Should have forced_plugins merged with mobile plugins but only whitelisted user plugins', { validate: true, external_plugins: {}, forced_plugins: ['a'], plugins: 'a lists', ...(isiPhone ? { theme: 'mobile' } : { } ) }, EditorSettings.combineSettings(true, {}, { forced_plugins: ['a'] }, { plugins: ['b'], mobile: { plugins: ['lists custom'] } }) ); })), Logger.t('Merged settings forced_plugins in default override forced_plugins in user settings', Step.sync(function () { Assertions.assertEq( 'Should not have user forced plugins', { validate: true, external_plugins: {}, forced_plugins: ['b'], plugins: 'a' }, EditorSettings.combineSettings(false, {}, { forced_plugins: ['a'] }, { forced_plugins: ['b'] }) ); })) ])), Logger.t('getParam hash (legacy)', Step.sync(function () { const editor = new Editor('id', { hash1: 'a,b,c', hash2: 'a', hash3: 'a=b', hash4: 'a=b;c=d,e', hash5: 'a=b,c=d' }, EditorManager); Assertions.assertEq('Should be expected object', { a: 'a', b: 'b', c: 'c' }, EditorSettings.getParam(editor, 'hash1', {}, 'hash')); Assertions.assertEq('Should be expected object', { a: 'a' }, EditorSettings.getParam(editor, 'hash2', {}, 'hash')); Assertions.assertEq('Should be expected object', { a: 'b' }, EditorSettings.getParam(editor, 'hash3', {}, 'hash')); Assertions.assertEq('Should be expected object', { a: 'b', c: 'd,e' }, EditorSettings.getParam(editor, 'hash4', {}, 'hash')); Assertions.assertEq('Should be expected object', { a: 'b', c: 'd' }, EditorSettings.getParam(editor, 'hash5', {}, 'hash')); Assertions.assertEq('Should be expected default object', { b: 2 }, EditorSettings.getParam(editor, 'hash_undefined', { b: 2 }, 'hash')); })), Logger.t('getParam primary types', Step.sync(function () { const editor = new Editor('id', { bool: true, str: 'a', num: 2, obj: { a: 1 }, arr: [ 'a' ], fun: () => {}, strArr: ['a', 'b'], mixedArr: ['a', 3] }, EditorManager); Assertions.assertEq('Should be expected bool', true, EditorSettings.getParam(editor, 'bool', false, 'boolean')); Assertions.assertEq('Should be expected string', 'a', EditorSettings.getParam(editor, 'str', 'x', 'string')); Assertions.assertEq('Should be expected number', 2, EditorSettings.getParam(editor, 'num', 1, 'number')); Assertions.assertEq('Should be expected object', { a: 1 }, EditorSettings.getParam(editor, 'obj', {}, 'object')); Assertions.assertEq('Should be expected array', [ 'a' ], EditorSettings.getParam(editor, 'arr', [], 'array')); Assertions.assertEq('Should be expected function', 'function', typeof EditorSettings.getParam(editor, 'fun', null, 'function')); Assertions.assertEq('Should be expected default bool', false, EditorSettings.getParam(editor, 'bool_undefined', false, 'boolean')); Assertions.assertEq('Should be expected default string', 'x', EditorSettings.getParam(editor, 'str_undefined', 'x', 'string')); Assertions.assertEq('Should be expected default number', 1, EditorSettings.getParam(editor, 'num_undefined', 1, 'number')); Assertions.assertEq('Should be expected default object', {}, EditorSettings.getParam(editor, 'obj_undefined', {}, 'object')); Assertions.assertEq('Should be expected default array', [], EditorSettings.getParam(editor, 'arr_undefined', [], 'array')); Assertions.assertEq('Should be expected default function', null, EditorSettings.getParam(editor, 'fun_undefined', null, 'function')); Assertions.assertEq('Should be expected string array', ['a', 'b'], EditorSettings.getParam(editor, 'strArr', ['x'], 'string[]')); Assertions.assertEq('Should be expected default array on mixed types', ['x'], EditorSettings.getParam(editor, 'mixedArr', ['x'], 'string[]')); Assertions.assertEq('Should be expected default array on boolean', ['x'], EditorSettings.getParam(editor, 'bool', ['x'], 'string[]')); })) ], onSuccess, onFailure); }, { base_url: '/project/tinymce/js/tinymce' }, success, failure); });