Browse Source

Tests: Fix SetHeaderRowCommand.

Maciej Gołaszewski 7 years ago
parent
commit
11a1c58bed

+ 1 - 1
packages/ckeditor5-table/src/commands/setheaderrowcommand.js

@@ -79,7 +79,7 @@ export default class SetHeaderRowCommand extends Command {
 	_isInHeading( tableCell, table ) {
 		const headingRows = parseInt( table.getAttribute( 'headingRows' ) || 0 );
 
-		return headingRows && tableCell.parent.index < headingRows;
+		return !!headingRows && tableCell.parent.index < headingRows;
 	}
 }
 

+ 9 - 0
packages/ckeditor5-table/tests/commands/setheaderrowcommand.js

@@ -93,6 +93,15 @@ describe( 'HeaderRowCommand', () => {
 	} );
 
 	describe( 'value', () => {
+		it( 'should be false if selection is not in a table without heading row', () => {
+			setData( model, modelTable( [
+				[ '01[]', '02' ],
+				[ '11', '12' ]
+			] ) );
+
+			expect( command.value ).to.be.false;
+		} );
+
 		it( 'should be false if selection is not in a heading row', () => {
 			setData( model, modelTable( [
 				[ '01', '02' ],