浏览代码

Add unit test

Check if balloon editor throws an error when is created inside textarea.
Mateusz Samsel 6 年之前
父节点
当前提交
5600953755
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      packages/ckeditor5-editor-balloon/tests/ballooneditor.js

+ 15 - 0
packages/ckeditor5-editor-balloon/tests/ballooneditor.js

@@ -195,6 +195,21 @@ describe( 'BalloonEditor', () => {
 					return newEditor.destroy();
 				} );
 		} );
+
+		it( 'throws an error when is initialized in textarea', done => {
+			BalloonEditor.create( document.createElement( 'textarea' ) )
+				.then(
+					() => {
+						expect.fail( 'Balloon editor should throw an error when is initialized in textarea.' );
+					},
+					err => {
+						expect( err ).to.be.an( 'error' ).with.property( 'message' ).and
+							.match( /^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./ );
+					}
+				)
+				.then( done )
+				.catch( done );
+		} );
 	} );
 
 	describe( 'create - events', () => {