瀏覽代碼

Added tests.

Szymon Kupś 7 年之前
父節點
當前提交
686fd6ccfc
共有 1 個文件被更改,包括 19 次插入1 次删除
  1. 19 1
      packages/ckeditor5-editor-balloon/tests/ballooneditor.js

+ 19 - 1
packages/ckeditor5-editor-balloon/tests/ballooneditor.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document, Event */
+/* globals document, Event, HTMLElement */
 
 import BalloonEditorUI from '../src/ballooneditorui';
 import BalloonEditorUIView from '../src/ballooneditoruiview';
@@ -102,6 +102,24 @@ describe( 'BalloonEditor', () => {
 				} );
 			} );
 		} );
+
+		it( 'allows to pass data to the constructor', () => {
+			return BalloonEditor.create( '<p>Hello world!</p>', {
+				plugins: [ Paragraph ]
+			} ).then( editor => {
+				expect( editor.getData() ).to.equal( '<p>Hello world!</p>' );
+			} );
+		} );
+
+		it( 'editor.element should contain created div element', () => {
+			return BalloonEditor.create( '<p>Hello world!</p>', {
+				plugins: [ Paragraph ]
+			} ).then( editor => {
+				expect( editor.element ).to.be.instanceOf( HTMLElement );
+				expect( editor.element.tagName ).to.equal( 'DIV' );
+				expect( editor.editing.view.getDomRoot() ).to.equal( editor.element );
+			} );
+		} );
 	} );
 
 	describe( 'create()', () => {