Explorar el Código

Add unit test

Check if decoupled editor throws an error when is created in textarea
Mateusz Samsel hace 6 años
padre
commit
0e8fd5955d
Se han modificado 1 ficheros con 15 adiciones y 0 borrados
  1. 15 0
      packages/ckeditor5-editor-decoupled/tests/decouplededitor.js

+ 15 - 0
packages/ckeditor5-editor-decoupled/tests/decouplededitor.js

@@ -134,6 +134,21 @@ describe( 'DecoupledEditor', () => {
 			} );
 		} );
 
+		it( 'throws error if it is initialized in textarea', done => {
+			DecoupledEditor.create( document.createElement( 'textarea' ) )
+				.then(
+					() => {
+						expect.fail( 'Decoupled 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 );
+		} );
+
 		function test( getElementOrData ) {
 			it( 'creates an instance which inherits from the DecoupledEditor', () => {
 				return DecoupledEditor