OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
test
/
ts
/
browser
/
content
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:14:55 AM
rwxr-xr-x
📄
EditorContentNotInitializedTest.ts
3 KB
02/20/2020 06:13:03 AM
rw-r--r--
📄
EditorContentTest.ts
4.56 KB
02/20/2020 06:13:05 AM
rw-r--r--
📄
EditorContentWsTest.ts
769 bytes
02/20/2020 06:13:04 AM
rw-r--r--
📄
EditorGetContentTextFormatTest.ts
949 bytes
02/20/2020 06:13:05 AM
rw-r--r--
📄
EditorGetContentTreeTest.ts
1.83 KB
02/20/2020 06:13:06 AM
rw-r--r--
📄
EditorResetContentTest.ts
2.51 KB
02/20/2020 06:13:06 AM
rw-r--r--
📄
InsertContentCommandTest.ts
18.76 KB
02/20/2020 06:13:07 AM
rw-r--r--
📄
InsertContentForcedRootFalseTest.ts
1.79 KB
02/20/2020 06:13:07 AM
rw-r--r--
📄
InsertContentTest.ts
8.71 KB
02/20/2020 06:13:08 AM
rw-r--r--
📄
InsertContentWebKitBugs.ts
1.12 KB
02/20/2020 06:13:08 AM
rw-r--r--
📄
InsertListTest.ts
2.52 KB
02/20/2020 06:13:09 AM
rw-r--r--
Editing: EditorResetContentTest.ts
Close
import { GeneralSteps, Logger, Pipeline, Step, Assertions } from '@ephox/agar'; import { UnitTest } from '@ephox/bedrock'; import { TinyApis, TinyLoader } from '@ephox/mcagar'; import Theme from 'tinymce/themes/silver/Theme'; import Editor from 'tinymce/core/api/Editor'; UnitTest.asynctest('browser.tinymce.core.content.EditorResetContentTest', (success, failure) => { Theme(); TinyLoader.setup((editor: Editor, onSuccess, onFailure) => { const tinyApis = TinyApis(editor); const sResetContent = (content?: string) => { return Step.sync(() => { editor.resetContent(content); }); }; const sAssertEditorState = (content: string) => { return Step.sync(() => { const html = editor.getContent(); Assertions.assertHtml('Editor content should be expected html', content, html); Assertions.assertEq('Editor should not be dirty', false, editor.isDirty()); Assertions.assertEq('UndoManager should not have any undo levels', false, editor.undoManager.hasUndo()); Assertions.assertEq('UndoManager should not have any redo levels', false, editor.undoManager.hasRedo()); Assertions.assertEq('Editor start content should match the original content', '<p><br data-mce-bogus="1"></p>', editor.startContent); }); }; Pipeline.async({}, [ Logger.t('Reset editor content/state with initial content', GeneralSteps.sequence([ tinyApis.sSetContent('<p>some</p><p>content</p>'), sResetContent(), sAssertEditorState('') ])), Logger.t('Reset editor content/state with custom content', GeneralSteps.sequence([ tinyApis.sSetContent('<p>some</p><p>content</p>'), sResetContent('<p>html</p>'), sAssertEditorState('<p>html</p>') ])), Logger.t('Reset editor content/state with multiple undo levels', GeneralSteps.sequence([ tinyApis.sSetContent('<p>some</p><p>content</p>'), Step.sync(() => editor.undoManager.add()), tinyApis.sSetContent('<p>some</p><p>other</p><p>content</p>'), Step.sync(() => editor.undoManager.add()), tinyApis.sNodeChanged, Step.sync(() => { Assertions.assertEq('Editor should be dirty', true, editor.isDirty()); Assertions.assertEq('UndoManager should have some undo levels', true, editor.undoManager.hasUndo()); }), sResetContent('<p>html</p>'), sAssertEditorState('<p>html</p>') ])) ], onSuccess, onFailure); }, { base_url: '/project/tinymce/js/tinymce' }, success, failure); });