|
|
@@ -7,14 +7,9 @@
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
-import BoxedEditorUI from '/ckeditor5/ui/editorui/boxed/boxededitorui.js';
|
|
|
+import ClassicEditorUI from '/ckeditor5/creator-classic/classiceditorui.js';
|
|
|
import BoxedEditorUIView from '/ckeditor5/ui/editorui/boxed/boxededitoruiview.js';
|
|
|
|
|
|
-// import EditableUI from '/ckeditor5/ui/editableui/editableui.js';
|
|
|
-// import InlineEditableUIView from '/ckeditor5/ui/editableui/inline/inlineeditableuiview.js';
|
|
|
-
|
|
|
-// import StickyToolbarView from '/ckeditor5/ui/stickytoolbar/stickytoolbarview.js';
|
|
|
-
|
|
|
import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
|
|
|
|
|
|
import ClassicEditor from '/ckeditor5/creator-classic/classic.js';
|
|
|
@@ -38,23 +33,12 @@ describe( 'ClassicEditor', () => {
|
|
|
editorElement.remove();
|
|
|
} );
|
|
|
|
|
|
- describe( 'create', () => {
|
|
|
- beforeEach( function() {
|
|
|
- return ClassicEditor.create( editorElement, {
|
|
|
- features: [ 'paragraph', 'basic-styles/bold', 'basic-styles/italic' ],
|
|
|
- toolbar: [ 'bold', 'italic' ]
|
|
|
- } )
|
|
|
- .then( newEditor => {
|
|
|
- editor = newEditor;
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'creates an instance which inherits from the ClassicEditor', () => {
|
|
|
- expect( editor ).to.be.instanceof( ClassicEditor );
|
|
|
+ describe( 'constructor', () => {
|
|
|
+ beforeEach( () => {
|
|
|
+ editor = new ClassicEditor( editorElement );
|
|
|
} );
|
|
|
|
|
|
it( 'creates a single div editable root in the view', () => {
|
|
|
- expect( editor.editing.view.domRoots.size ).to.equal( 1 );
|
|
|
expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );
|
|
|
} );
|
|
|
|
|
|
@@ -64,16 +48,35 @@ describe( 'ClassicEditor', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'creates the UI using BoxedEditorUI classes', () => {
|
|
|
- expect( editor.ui ).to.be.instanceof( BoxedEditorUI );
|
|
|
+ expect( editor.ui ).to.be.instanceof( ClassicEditorUI );
|
|
|
expect( editor.ui.view ).to.be.instanceof( BoxedEditorUIView );
|
|
|
} );
|
|
|
|
|
|
+ it( 'uses HTMLDataProcessor', () => {
|
|
|
+ expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
+ describe( 'create', () => {
|
|
|
+ beforeEach( function() {
|
|
|
+ return ClassicEditor.create( editorElement, {
|
|
|
+ features: [ 'paragraph', 'basic-styles/bold' ]
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ editor = newEditor;
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'creates an instance which inherits from the ClassicEditor', () => {
|
|
|
+ expect( editor ).to.be.instanceof( ClassicEditor );
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'inserts editor UI next to editor element', () => {
|
|
|
expect( editor.ui.view.element.previousSibling ).to.equal( editorElement );
|
|
|
} );
|
|
|
|
|
|
- it( 'uses HTMLDataProcessor', () => {
|
|
|
- expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
|
|
|
+ it( 'attaches editable UI as view\'s DOM root', () => {
|
|
|
+ expect( editor.editing.view.getDomRoot() ).to.equal( editor.ui.editable.view.element );
|
|
|
} );
|
|
|
|
|
|
it( 'loads data from the editor element', () => {
|
|
|
@@ -97,5 +100,14 @@ describe( 'ClassicEditor', () => {
|
|
|
expect( editorElement.innerHTML ).to.equal( '<p>foo</p>' );
|
|
|
} );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'restores the editor element', () => {
|
|
|
+ expect( editor.element.style.display ).to.equal( 'none' );
|
|
|
+
|
|
|
+ return editor.destroy()
|
|
|
+ .then( () => {
|
|
|
+ expect( editor.element.style.display ).to.equal( '' );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
} );
|
|
|
} );
|