Browse Source

Tests: Add explicit tests for `<table>` inside `<figure>` element upcasting.

Maciej Gołaszewski 7 years ago
parent
commit
0b7b8be126
1 changed files with 38 additions and 0 deletions
  1. 38 0
      packages/ckeditor5-table/tests/converters/upcasttable.js

+ 38 - 0
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -58,6 +58,22 @@ describe( 'upcastTable()', () => {
 		expect( getModelData( model, { withoutSelection: true } ) ).to.equal( data );
 	}
 
+	it( 'should convert table figure', () => {
+		editor.setData(
+			'<figure class="table">' +
+			'<table>' +
+			'<tr><td>1</td></tr>' +
+			'</table>' +
+			'</figure>'
+		);
+
+		expectModel(
+			'<table>' +
+			'<tableRow><tableCell>1</tableCell></tableRow>' +
+			'</table>'
+		);
+	} );
+
 	it( 'should create table model from table without thead', () => {
 		editor.setData(
 			'<table>' +
@@ -72,6 +88,28 @@ describe( 'upcastTable()', () => {
 		);
 	} );
 
+	it( 'should not convert empty figure', () => {
+		'<figure class="table"></figure>';
+
+		expectModel( '' );
+	} );
+
+	it( 'should convert if figure do not have class="table" attribute', () => {
+		editor.setData(
+			'<figure>' +
+			'<table>' +
+			'<tr><td>1</td></tr>' +
+			'</table>' +
+			'</figure>'
+		);
+
+		expectModel(
+			'<table>' +
+			'<tableRow><tableCell>1</tableCell></tableRow>' +
+			'</table>'
+		);
+	} );
+
 	it( 'should create table model from table with one thead with one row', () => {
 		editor.setData(
 			'<table>' +