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: SelectionOverridesTest.ts
Close
import { Keyboard, Pipeline } from '@ephox/agar'; import { LegacyUnit, TinyDom, TinyLoader } from '@ephox/mcagar'; import Env from 'tinymce/core/api/Env'; import * as CaretContainer from 'tinymce/core/caret/CaretContainer'; import KeyUtils from '../module/test/KeyUtils'; import VK from 'tinymce/core/api/util/VK'; import Theme from 'tinymce/themes/silver/Theme'; import { UnitTest } from '@ephox/bedrock'; import { document } from '@ephox/dom-globals'; UnitTest.asynctest('browser.tinymce.core.SelectionOverridesTest', function () { const success = arguments[arguments.length - 2]; const failure = arguments[arguments.length - 1]; const suite = LegacyUnit.createSuite(); Theme(); const pressKey = function (key) { return function (editor) { Keyboard.keystroke(key, {}, TinyDom.fromDom(editor.getBody())); }; }; const exitPreTest = function (arrow, offset, expectedContent) { return function (editor) { editor.setContent('<pre>abc</pre>'); LegacyUnit.setSelection(editor, 'pre', 1); arrow(editor); LegacyUnit.equal(editor.getContent(), '<pre>abc</pre>'); LegacyUnit.equal(editor.selection.getNode().nodeName, 'PRE'); LegacyUnit.setSelection(editor, 'pre', offset); arrow(editor); LegacyUnit.equal(editor.getContent(), expectedContent); LegacyUnit.equal(editor.selection.getNode().nodeName, 'P'); }; }; const ok = function (a, label) { LegacyUnit.equal(a, true, label); }; const leftArrow = pressKey(VK.LEFT); const rightArrow = pressKey(VK.RIGHT); const upArrow = pressKey(VK.UP); const downArrow = pressKey(VK.DOWN); suite.test('left/right over cE=false inline', function (editor) { editor.focus(); editor.setContent('<span contenteditable="false">1</span>'); editor.selection.select(editor.$('span')[0]); leftArrow(editor); LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>'); LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.selection.getRng().startContainer), true); LegacyUnit.equalDom(editor.selection.getRng().startContainer, editor.$('p')[0].firstChild); rightArrow(editor); LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>'); LegacyUnit.equalDom(editor.selection.getNode(), editor.$('span')[0]); rightArrow(editor); LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>'); LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.selection.getRng().startContainer), true); LegacyUnit.equalDom(editor.selection.getRng().startContainer, editor.$('p')[0].lastChild); }); suite.test('left/right over cE=false block', function (editor) { editor.setContent('<p contenteditable="false">1</p>'); editor.selection.select(editor.$('p[contenteditable=false]')[0]); leftArrow(editor); LegacyUnit.equal(editor.getContent(), '<p contenteditable="false">1</p>'); LegacyUnit.equal(CaretContainer.isCaretContainerBlock(editor.selection.getRng().startContainer), true); rightArrow(editor); LegacyUnit.equal(editor.getContent(), '<p contenteditable="false">1</p>'); LegacyUnit.equalDom(editor.selection.getNode(), editor.$('p[contenteditable=false]')[0]); rightArrow(editor); LegacyUnit.equal(editor.getContent(), '<p contenteditable="false">1</p>'); LegacyUnit.equal(CaretContainer.isCaretContainerBlock(editor.selection.getRng().startContainer), true); }); suite.test('left before cE=false block and type', function (editor) { editor.setContent('<p contenteditable="false">1</p>'); editor.selection.select(editor.$('p')[0]); leftArrow(editor); KeyUtils.type(editor, 'a'); LegacyUnit.equal(editor.getContent(), '<p>a</p><p contenteditable="false">1</p>'); LegacyUnit.equal(CaretContainer.isCaretContainerBlock(editor.selection.getRng().startContainer.parentNode), false); }); suite.test('right after cE=false block and type', function (editor) { editor.setContent('<p contenteditable="false">1</p>'); editor.selection.select(editor.$('p[contenteditable=false]')[0]); rightArrow(editor); KeyUtils.type(editor, 'a'); LegacyUnit.equal(editor.getContent(), '<p contenteditable="false">1</p><p>a</p>'); LegacyUnit.equal(CaretContainer.isCaretContainerBlock(editor.selection.getRng().startContainer.parentNode), false); }); suite.test('up from P to inline cE=false', function (editor) { editor.setContent('<p>a<span contentEditable="false">1</span></p><p>abc</p>'); LegacyUnit.setSelection(editor, 'p:last', 3); upArrow(editor); LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.$('p:first')[0].lastChild), true); }); suite.test('down from P to inline cE=false', function (editor) { editor.setContent('<p>abc</p><p>a<span contentEditable="false">1</span></p>'); LegacyUnit.setSelection(editor, 'p:first', 3); downArrow(editor); LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.$('p:last')[0].lastChild), true); }); suite.test('exit pre block (up)', exitPreTest(upArrow, 0, '<p>\u00a0</p><pre>abc</pre>')); suite.test('exit pre block (left)', exitPreTest(leftArrow, 0, '<p>\u00a0</p><pre>abc</pre>')); suite.test('exit pre block (down)', exitPreTest(downArrow, 3, '<pre>abc</pre><p>\u00a0</p>')); suite.test('exit pre block (right)', exitPreTest(rightArrow, 3, '<pre>abc</pre><p>\u00a0</p>')); suite.test('click on link in cE=false', function (editor) { editor.setContent('<p contentEditable="false"><a href="#"><strong>link</strong></a></p>'); const evt = editor.fire('click', { target: editor.$('strong')[0] }); LegacyUnit.equal(evt.isDefaultPrevented(), true); }); suite.test('click next to cE=false block', function (editor) { editor.setContent( '<table style="width: 100%">' + '<tr>' + '<td style="vertical-align: top">1</td>' + '<td><div contentEditable="false" style="width: 100px; height: 100px">2</div></td>' + '</tr>' + '</table>' ); const firstTd = editor.dom.select('td')[0]; const rect = editor.dom.getRect(firstTd); editor.fire('mousedown', { target: firstTd, clientX: rect.x + rect.w, clientY: rect.y + 10 }); // Since we can't do a real click we need to check if it gets sucked in towards the cE=false block LegacyUnit.equal(editor.selection.getNode().nodeName !== 'P', true); }); suite.test('offscreen copy of cE=false block remains offscreen', function (editor) { if (Env.ie || Env.gecko) { editor.setContent( '<table contenteditable="false" style="width: 100%; table-layout: fixed">' + '<tbody><tr><td>1</td><td>2</td></tr></tbody>' + '</table>' ); editor.selection.select(editor.dom.select('table')[0]); const offscreenSelection = editor.dom.select('.mce-offscreen-selection')[0]; ok(offscreenSelection.offsetLeft !== undefined, 'The offscreen selection\'s left border is undefined'); ok(offscreenSelection.offsetLeft < 0, 'The offscreen selection\'s left border is onscreen'); ok(offscreenSelection.offsetWidth + offscreenSelection.offsetLeft < 0, 'The cE=false offscreen selection is visible on-screen. Right edge: ' + offscreenSelection.offsetLeft + '+' + offscreenSelection.offsetWidth + '=' + (offscreenSelection.offsetLeft + offscreenSelection.offsetWidth) + 'px' ); } else { // Chrome and Safari behave correctly, and PhantomJS also declares itself as WebKit but does not // put the off-screen selection off-screen, so fails the above tests. However, it has no visible UI, // so everything is off-screen anyway :-) ok(true, 'Not a tested browser - Chrome & Safari work, PhantomJS does not put the selection off screen'); } }); suite.test('set range after ce=false element but lean backwards', function (editor) { editor.setContent('<p contenteditable="false">1</p><p contenteditable="false">2</p>'); const rng = document.createRange(); rng.setStartBefore(editor.dom.select('p[contenteditable=false]')[1]); rng.setEndBefore(editor.dom.select('p[contenteditable=false]')[1]); editor.selection.setRng(rng, false); LegacyUnit.equal(editor.selection.getNode().getAttribute('data-mce-caret'), 'after'); }); suite.test('set range after ce=false element but lean forwards', function (editor) { editor.setContent('<p contenteditable="false">1</p><p contenteditable="false">2</p>'); const rng = document.createRange(); rng.setStartBefore(editor.dom.select('p[contenteditable=false]')[1]); rng.setEndBefore(editor.dom.select('p[contenteditable=false]')[1]); editor.selection.setRng(rng, true); LegacyUnit.equal(editor.selection.getNode().getAttribute('data-mce-caret'), 'before'); }); suite.test('showCaret at TD', function (editor) { let rng; editor.setContent('<table><tr><td contenteditable="false">x</td></tr></table>'); rng = editor._selectionOverrides.showCaret(1, editor.dom.select('td')[0], true); LegacyUnit.equal(true, rng === null, 'Should be null since TD is not a valid caret target'); }); suite.test('showCaret at TH', function (editor) { let rng; editor.setContent('<table><tr><th contenteditable="false">x</th></tr></table>'); rng = editor._selectionOverrides.showCaret(1, editor.dom.select('th')[0], true); LegacyUnit.equal(true, rng === null, 'Should be null since TH is not a valid caret target'); }); suite.test('showCaret block on specific element', function (editor) { let rng; editor.on('ShowCaret', function (e) { if (e.target.getAttribute('data-no-cef') === 'true') { e.preventDefault(); } }); editor.setContent('<p contenteditable="false">a</p><p contenteditable="false" data-no-cef="true">b</p>'); rng = editor._selectionOverrides.showCaret(1, editor.dom.select('p[contenteditable=false]')[0], true); LegacyUnit.equal(true, rng !== null, 'Should return a range'); editor._selectionOverrides.hideFakeCaret(); rng = editor._selectionOverrides.showCaret(1, editor.dom.select('p[contenteditable=false]')[1], false); LegacyUnit.equal(true, rng === null, 'Should not return a range excluded by ShowCaret event'); editor._selectionOverrides.hideFakeCaret(); }); TinyLoader.setup(function (editor, onSuccess, onFailure) { Pipeline.async({}, suite.toSteps(editor), onSuccess, onFailure); }, { selector: 'textarea', add_unload_trigger: false, disable_nodechange: true, entities: 'raw', indent: false, base_url: '/project/tinymce/js/tinymce' }, success, failure); });