OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
test
/
ts
/
browser
/
selection
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:14:55 AM
rwxr-xr-x
📄
DetailsElementTest.ts
2.35 KB
02/20/2020 06:14:41 AM
rw-r--r--
📄
FragmentReaderTest.ts
10.22 KB
02/20/2020 06:14:41 AM
rw-r--r--
📄
GetSelectionContentTest.ts
3.84 KB
02/20/2020 06:14:42 AM
rw-r--r--
📄
MultiClickSelectionTest.ts
1.92 KB
02/20/2020 06:14:42 AM
rw-r--r--
📄
NormalizeRangeTest.ts
13.26 KB
02/20/2020 06:14:43 AM
rw-r--r--
📄
RangeInsertNodeTest.ts
3.11 KB
02/20/2020 06:14:43 AM
rw-r--r--
📄
RangeNormalizerTest.ts
4.48 KB
02/20/2020 06:14:44 AM
rw-r--r--
📄
SelectionBookmarkIframeEditorTest.ts
4.57 KB
02/20/2020 06:14:44 AM
rw-r--r--
📄
SelectionBookmarkInlineEditorTest.ts
8.22 KB
02/20/2020 06:14:45 AM
rw-r--r--
📄
SelectionBookmarkTest.ts
7.51 KB
02/20/2020 06:14:45 AM
rw-r--r--
📄
SelectionUtilsTest.ts
3.35 KB
02/20/2020 06:14:47 AM
rw-r--r--
📄
SetSelectionContentTest.ts
6.33 KB
02/20/2020 06:14:47 AM
rw-r--r--
📄
SimpleTableModelTest.ts
6.95 KB
02/20/2020 06:14:47 AM
rw-r--r--
📄
TableCellSelectionTest.ts
2.26 KB
02/20/2020 06:14:48 AM
rw-r--r--
Editing: RangeInsertNodeTest.ts
Close
import { GeneralSteps, Logger, Pipeline, Step, ApproxStructure } from '@ephox/agar'; import { TinyApis, TinyLoader } from '@ephox/mcagar'; import Theme from 'tinymce/themes/silver/Theme'; import { UnitTest } from '@ephox/bedrock'; import Editor from 'tinymce/core/api/Editor'; import { rangeInsertNode } from 'tinymce/core/selection/RangeInsertNode'; import { Node, DocumentFragment, Document } from '@ephox/dom-globals'; import { Fragment, Elements } from '@ephox/sugar'; UnitTest.asynctest('browser.tinymce.core.selection.RangeInsertNode', (success, failure) => { Theme(); const sRangeInsertNode = (editor: Editor, node: Node | DocumentFragment) => { return Step.sync(() => { rangeInsertNode(editor.dom, editor.selection.getRng(), node); }); }; const fragmentFromHtml = (html: string, scope: Document): DocumentFragment => { return Fragment.fromElements(Elements.fromHtml(html, scope), scope).dom(); }; TinyLoader.setup((editor: Editor, onSuccess, onFailure) => { const tinyApis = TinyApis(editor); const doc = editor.getDoc(); Pipeline.async({}, [ Logger.t('Insert node at start of text', GeneralSteps.sequence([ tinyApis.sFocus, tinyApis.sSetRawContent('<p>a</p>'), tinyApis.sSetCursor([0, 0], 0), sRangeInsertNode(editor, doc.createTextNode('X')), tinyApis.sAssertContentStructure( ApproxStructure.build((s, str, arr) => { return s.element('body', { children: [ s.element('p', { children: [ s.text(str.is('X')), s.text(str.is('a')) ] }) ] }); }) ) ])), Logger.t('Insert node at end of text', GeneralSteps.sequence([ tinyApis.sFocus, tinyApis.sSetRawContent('<p>a</p>'), tinyApis.sSetCursor([0, 0], 1), sRangeInsertNode(editor, doc.createTextNode('X')), tinyApis.sAssertContentStructure( ApproxStructure.build((s, str, arr) => { return s.element('body', { children: [ s.element('p', { children: [ s.text(str.is('a')), s.text(str.is('X')) ] }) ] }); }) ) ])), Logger.t('Insert document fragment at start of text', GeneralSteps.sequence([ tinyApis.sFocus, tinyApis.sSetRawContent('<p>a</p>'), tinyApis.sSetCursor([0, 0], 0), sRangeInsertNode(editor, fragmentFromHtml('X', doc)), tinyApis.sAssertContentStructure( ApproxStructure.build((s, str, arr) => { return s.element('body', { children: [ s.element('p', { children: [ s.text(str.is('X')), s.text(str.is('a')) ] }) ] }); }) ) ])), ], onSuccess, onFailure); }, { indent: false, base_url: '/project/tinymce/js/tinymce' }, success, failure); });