Przeglądaj źródła

Fixed test for setData utils method.

Oskar Wrobel 9 lat temu
rodzic
commit
b6cd907055

+ 3 - 3
packages/ckeditor5-engine/tests/_utils-tests/model.js

@@ -51,7 +51,7 @@ describe( 'model test utils', () => {
 		it( 'should throw an error when passing invalid document', () => {
 			expect( () => {
 				getData( { invalid: 'document' } );
-			} ).to.throw( TypeError, /Document needs to be an instance of engine.model.Document/ );
+			} ).to.throw( TypeError, /Document needs to be an instance of engine\.model\.Document\./ );
 		} );
 	} );
 
@@ -84,8 +84,8 @@ describe( 'model test utils', () => {
 
 		it( 'should throw an error when passing invalid document', () => {
 			expect( () => {
-				getData( { invalid: 'document' } );
-			} ).to.throw( TypeError, /Document needs to be an instance of engine.model.Document/ );
+				setData( { invalid: 'document' } );
+			} ).to.throw( TypeError, /Document needs to be an instance of engine\.model\.Document\./ );
 		} );
 	} );
 

+ 3 - 3
packages/ckeditor5-engine/tests/_utils-tests/view.js

@@ -72,7 +72,7 @@ describe( 'view test utils', () => {
 			it( 'should throw an error when passing invalid document', () => {
 				expect( () => {
 					getData( { invalid: 'document' } );
-				} ).to.throw( TypeError, /Document needs to be an instance of engine.view.Document/ );
+				} ).to.throw( TypeError, /Document needs to be an instance of engine\.view\.Document\./ );
 			} );
 		} );
 
@@ -110,8 +110,8 @@ describe( 'view test utils', () => {
 
 			it( 'should throw an error when passing invalid document', () => {
 				expect( () => {
-					getData( { invalid: 'document' } );
-				} ).to.throw( TypeError, /Document needs to be an instance of engine.view.Document/ );
+					setData( { invalid: 'document' } );
+				} ).to.throw( TypeError, /Document needs to be an instance of engine\.view\.Document\./ );
 			} );
 		} );
 	} );

+ 2 - 2
packages/ckeditor5-engine/tests/_utils/model.js

@@ -28,7 +28,7 @@ import Document from '/ckeditor5/engine/model/document.js';
  */
 export function getData( document, options = {} ) {
 	if ( !( document instanceof Document ) ) {
-		throw new TypeError( 'Document needs to be an instance of engine.model.Document' );
+		throw new TypeError( 'Document needs to be an instance of engine.model.Document.' );
 	}
 
 	const withoutSelection = !!options.withoutSelection;
@@ -52,7 +52,7 @@ getData._stringify = stringify;
  */
 export function setData( document, data, options = {} ) {
 	if ( !( document instanceof Document ) ) {
-		throw new TypeError( 'Document needs to be an instance of engine.model.Document' );
+		throw new TypeError( 'Document needs to be an instance of engine.model.Document.' );
 	}
 
 	setData._parse( data, {

+ 2 - 2
packages/ckeditor5-engine/tests/_utils/view.js

@@ -38,7 +38,7 @@ const TEXT_RANGE_END_TOKEN = '}';
  */
 export function getData( document, options = {} ) {
 	if ( !( document instanceof Document ) ) {
-		throw new TypeError( 'Document needs to be an instance of engine.view.Document' );
+		throw new TypeError( 'Document needs to be an instance of engine.view.Document.' );
 	}
 
 	const withoutSelection = !!options.withoutSelection;
@@ -69,7 +69,7 @@ getData._stringify = stringify;
  */
 export function setData( document, data, options = {} ) {
 	if ( !( document instanceof Document ) ) {
-		throw new TypeError( 'Document needs to be an instance of engine.view.Document' );
+		throw new TypeError( 'Document needs to be an instance of engine.view.Document.' );
 	}
 
 	const rootName = options.rootName || 'main';