8
0
Просмотр исходного кода

Duplicate beforeEach call to make test independent. See ckeditor/ckeditor5#6574.

Maciej Gołaszewski 5 лет назад
Родитель
Сommit
b404b3431e
1 измененных файлов с 108 добавлено и 17 удалено
  1. 108 17
      packages/ckeditor5-table/tests/converters/downcast.js

+ 108 - 17
packages/ckeditor5-table/tests/converters/downcast.js

@@ -42,24 +42,25 @@ describe( 'downcast converters', () => {
 
 
 	testUtils.createSinonSandbox();
 	testUtils.createSinonSandbox();
 
 
-	beforeEach( () => {
-		// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
-		testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
-
-		return VirtualTestEditor.create()
-			.then( newEditor => {
-				editor = newEditor;
-				model = editor.model;
-				doc = model.document;
-				root = doc.getRoot( 'main' );
-				view = editor.editing.view;
-
-				defaultSchema( model.schema );
-				defaultConversion( editor.conversion );
-			} );
-	} );
-
 	describe( 'downcastInsertTable()', () => {
 	describe( 'downcastInsertTable()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should create table with tbody', () => {
 		it( 'should create table with tbody', () => {
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 
 
@@ -355,6 +356,24 @@ describe( 'downcast converters', () => {
 	} );
 	} );
 
 
 	describe( 'downcastInsertRow()', () => {
 	describe( 'downcastInsertRow()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should react to changed rows', () => {
 		it( 'should react to changed rows', () => {
 			setModelData( model, modelTable( [
 			setModelData( model, modelTable( [
 				[ '00', '01' ]
 				[ '00', '01' ]
@@ -592,6 +611,24 @@ describe( 'downcast converters', () => {
 	} );
 	} );
 
 
 	describe( 'downcastInsertCell()', () => {
 	describe( 'downcastInsertCell()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should add tableCell on proper index in tr', () => {
 		it( 'should add tableCell on proper index in tr', () => {
 			setModelData( model, modelTable( [
 			setModelData( model, modelTable( [
 				[ '00', '01' ]
 				[ '00', '01' ]
@@ -736,6 +773,24 @@ describe( 'downcast converters', () => {
 	} );
 	} );
 
 
 	describe( 'downcastTableHeadingColumnsChange()', () => {
 	describe( 'downcastTableHeadingColumnsChange()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should work for adding heading columns', () => {
 		it( 'should work for adding heading columns', () => {
 			setModelData( model, modelTable( [
 			setModelData( model, modelTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
@@ -912,6 +967,24 @@ describe( 'downcast converters', () => {
 	} );
 	} );
 
 
 	describe( 'downcastTableHeadingRowsChange()', () => {
 	describe( 'downcastTableHeadingRowsChange()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should work for adding heading rows', () => {
 		it( 'should work for adding heading rows', () => {
 			setModelData( model, modelTable( [
 			setModelData( model, modelTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
@@ -1126,6 +1199,24 @@ describe( 'downcast converters', () => {
 	} );
 	} );
 
 
 	describe( 'downcastRemoveRow()', () => {
 	describe( 'downcastRemoveRow()', () => {
+		// The beforeEach is duplicated due to ckeditor/ckeditor5#6574. New test are written using TableEdting.
+		beforeEach( () => {
+			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
+			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
+
+			return VirtualTestEditor.create()
+				.then( newEditor => {
+					editor = newEditor;
+					model = editor.model;
+					doc = model.document;
+					root = doc.getRoot( 'main' );
+					view = editor.editing.view;
+
+					defaultSchema( model.schema );
+					defaultConversion( editor.conversion );
+				} );
+		} );
+
 		it( 'should react to removed row from the beginning of a tbody', () => {
 		it( 'should react to removed row from the beginning of a tbody', () => {
 			setModelData( model, modelTable( [
 			setModelData( model, modelTable( [
 				[ '00[]', '01' ],
 				[ '00[]', '01' ],