Skip to content

Commit

Permalink
Duplicate beforeEach call to make test independent. See #6574.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Apr 8, 2020
1 parent d48c585 commit b404b34
Showing 1 changed file with 108 additions and 17 deletions.
125 changes: 108 additions & 17 deletions packages/ckeditor5-table/tests/converters/downcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,25 @@ describe( 'downcast converters', () => {

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()', () => {
// 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', () => {
setModelData( model, modelTable( [ [ '' ] ] ) );

Expand Down Expand Up @@ -355,6 +356,24 @@ describe( 'downcast converters', () => {
} );

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', () => {
setModelData( model, modelTable( [
[ '00', '01' ]
Expand Down Expand Up @@ -592,6 +611,24 @@ describe( 'downcast converters', () => {
} );

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', () => {
setModelData( model, modelTable( [
[ '00', '01' ]
Expand Down Expand Up @@ -736,6 +773,24 @@ describe( 'downcast converters', () => {
} );

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', () => {
setModelData( model, modelTable( [
[ '00', '01' ],
Expand Down Expand Up @@ -912,6 +967,24 @@ describe( 'downcast converters', () => {
} );

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', () => {
setModelData( model, modelTable( [
[ '00', '01' ],
Expand Down Expand Up @@ -1126,6 +1199,24 @@ describe( 'downcast converters', () => {
} );

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', () => {
setModelData( model, modelTable( [
[ '00[]', '01' ],
Expand Down

0 comments on commit b404b34

Please sign in to comment.