Przeglądaj źródła

Updated tests for TableWalker.

Kuba Niegowski 5 lat temu
rodzic
commit
18046a065c
1 zmienionych plików z 21 dodań i 0 usunięć
  1. 21 0
      packages/ckeditor5-table/tests/tablewalker.js

+ 21 - 0
packages/ckeditor5-table/tests/tablewalker.js

@@ -5,6 +5,7 @@
 
 import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
+import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 
 import { defaultConversion, defaultSchema, modelTable } from './_utils/utils';
 
@@ -259,4 +260,24 @@ describe( 'TableWalker', () => {
 			], { column: 1, includeSpanned: true } );
 		} );
 	} );
+
+	it( 'should return deprecated column option value', () => {
+		setData( model, modelTable( [
+			[ 'a' ]
+		] ) );
+
+		const walker = new TableWalker( root.getChild( 0 ), { column: 7 } );
+
+		expect( walker.column ).to.equal( 7 );
+	} );
+
+	it( 'should throw error if deprecated api used improperly', () => {
+		setData( model, modelTable( [
+			[ 'a' ]
+		] ) );
+
+		const walker = new TableWalker( root.getChild( 0 ), { startColumn: 1, endColumn: 2 } );
+
+		expect( () => walker.column ).to.throw( CKEditorError, 'improper-use-of-deprecated-api' );
+	} );
 } );