浏览代码

This is what happens when OCD kicks in.

Aleksander Nowodzinski 9 年之前
父节点
当前提交
24ea19830e
共有 1 个文件被更改,包括 36 次插入5 次删除
  1. 36 5
      packages/ckeditor5-core/tests/editor/standardeditor.js

+ 36 - 5
packages/ckeditor5-core/tests/editor/standardeditor.js

@@ -5,6 +5,7 @@
 
 /* globals document */
 
+import Editor from 'ckeditor5-core/src/editor/editor';
 import StandardEditor from 'ckeditor5-core/src/editor/standardeditor';
 import HtmlDataProcessor from 'ckeditor5-engine/src/dataprocessor/htmldataprocessor';
 import { getData, setData } from 'ckeditor5-engine/src/dev-utils/model';
@@ -45,6 +46,12 @@ describe( 'StandardEditor', () => {
 	} );
 
 	describe( 'destroy()', () => {
+		it( 'returns a Promise', () => {
+			const editor = new StandardEditor( editorElement, { foo: 1 } );
+
+			expect( editor.destroy() ).to.be.an.instanceof( Promise );
+		} );
+
 		it( 'destroys the #keystrokes', () => {
 			const editor = new StandardEditor( editorElement, { foo: 1 } );
 			const spy = sinon.spy( editor.keystrokes, 'destroy' );
@@ -56,9 +63,33 @@ describe( 'StandardEditor', () => {
 					sinon.assert.calledOnce( spy );
 				} );
 		} );
+
+		it( 'destroys the #editing', () => {
+			const editor = new StandardEditor( editorElement, { foo: 1 } );
+			const spy = sinon.spy( editor.editing, 'destroy' );
+
+			sinon.assert.notCalled( spy );
+
+			return editor.destroy()
+				.then( () => {
+					sinon.assert.calledOnce( spy );
+				} );
+		} );
+
+		it( 'destroys the parent', () => {
+			const editor = new StandardEditor( editorElement, { foo: 1 } );
+			const spy = sinon.spy( Editor.prototype, 'destroy' );
+
+			sinon.assert.notCalled( spy );
+
+			return editor.destroy()
+				.then( () => {
+					sinon.assert.calledOnce( spy );
+				} );
+		} );
 	} );
 
-	describe( 'create', () => {
+	describe( 'create()', () => {
 		it( 'initializes editor with plugins and config', () => {
 			class PluginFoo extends Plugin {}
 
@@ -100,7 +131,7 @@ describe( 'StandardEditor', () => {
 		} );
 	} );
 
-	describe( 'setData', () => {
+	describe( 'setData()', () => {
 		let editor;
 
 		beforeEach( () => {
@@ -127,7 +158,7 @@ describe( 'StandardEditor', () => {
 		} );
 	} );
 
-	describe( 'getData', () => {
+	describe( 'getData()', () => {
 		let editor;
 
 		beforeEach( () => {
@@ -154,7 +185,7 @@ describe( 'StandardEditor', () => {
 		} );
 	} );
 
-	describe( 'updateEditorElement', () => {
+	describe( 'updateEditorElement()', () => {
 		it( 'sets data to editor element', () => {
 			const editor = new StandardEditor( editorElement );
 
@@ -166,7 +197,7 @@ describe( 'StandardEditor', () => {
 		} );
 	} );
 
-	describe( 'loadDataFromEditorElement', () => {
+	describe( 'loadDataFromEditorElement()', () => {
 		it( 'sets data to editor element', () => {
 			const editor = new StandardEditor( editorElement );