|
@@ -135,60 +135,85 @@ describe( 'HeaderRowCommand', () => {
|
|
|
describe( 'execute()', () => {
|
|
describe( 'execute()', () => {
|
|
|
it( 'should set heading rows attribute that cover row in which is selection', () => {
|
|
it( 'should set heading rows attribute that cover row in which is selection', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ '00', '01' ],
|
|
|
|
|
- [ '[]10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
] ) );
|
|
] ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
- [ '00', '01' ],
|
|
|
|
|
- [ '[]10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
], { headingRows: 2 } ) );
|
|
], { headingRows: 2 } ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should toggle heading rows attribute', () => {
|
|
it( 'should toggle heading rows attribute', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ '[]00', '01' ],
|
|
|
|
|
- [ '10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
- ] ) );
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
|
|
+ ], { headingRows: 2 } ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
- [ '[]00', '01' ],
|
|
|
|
|
- [ '10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
], { headingRows: 1 } ) );
|
|
], { headingRows: 1 } ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ '[]00', '01' ],
|
|
|
|
|
- [ '10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
- ] ) );
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
|
|
+ ], { headingRows: 2 } ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should set heading rows attribute if currently selected row is a heading so the heading section is below this row', () => {
|
|
it( 'should set heading rows attribute if currently selected row is a heading so the heading section is below this row', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ '00', '01' ],
|
|
|
|
|
- [ '[]10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
- ], { headingRows: 2 } ) );
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
|
|
+ ], { headingRows: 3 } ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
- [ '00', '01' ],
|
|
|
|
|
- [ '[]10', '11' ],
|
|
|
|
|
- [ '20', '21' ]
|
|
|
|
|
|
|
+ [ '00' ],
|
|
|
|
|
+ [ '[]10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
], { headingRows: 1 } ) );
|
|
], { headingRows: 1 } ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ it( 'should unsetset heading rows attribute', () => {
|
|
|
|
|
+ setData( model, modelTable( [
|
|
|
|
|
+ [ '[]00' ],
|
|
|
|
|
+ [ '10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
|
|
+ ], { headingRows: 3 } ) );
|
|
|
|
|
+
|
|
|
|
|
+ command.execute();
|
|
|
|
|
+
|
|
|
|
|
+ expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
|
|
+ [ '[]00' ],
|
|
|
|
|
+ [ '10' ],
|
|
|
|
|
+ [ '20' ],
|
|
|
|
|
+ [ '30' ]
|
|
|
|
|
+ ] ) );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
it( 'should fix rowspaned cells on the edge of an table head section', () => {
|
|
it( 'should fix rowspaned cells on the edge of an table head section', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
[ '00', '01', '02' ],
|
|
@@ -229,29 +254,29 @@ describe( 'HeaderRowCommand', () => {
|
|
|
|
|
|
|
|
it( 'should fix rowspaned cells on the edge of an table head section when creating section', () => {
|
|
it( 'should fix rowspaned cells on the edge of an table head section when creating section', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ { rowspan: 2, contents: '[]00' }, '01' ],
|
|
|
|
|
- [ '11' ]
|
|
|
|
|
|
|
+ [ { rowspan: 2, contents: '00' }, '01' ],
|
|
|
|
|
+ [ '[]11' ]
|
|
|
], { headingRows: 2 } ) );
|
|
], { headingRows: 2 } ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
- [ '[]00', '01' ],
|
|
|
|
|
- [ '', '11' ]
|
|
|
|
|
|
|
+ [ '00', '01' ],
|
|
|
|
|
+ [ '', '[]11' ]
|
|
|
], { headingRows: 1 } ) );
|
|
], { headingRows: 1 } ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should fix rowspaned cells inside a row', () => {
|
|
it( 'should fix rowspaned cells inside a row', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ '00', { rowspan: 2, contents: '[]01' } ],
|
|
|
|
|
- [ '10' ]
|
|
|
|
|
|
|
+ [ '00', { rowspan: 2, contents: '01' } ],
|
|
|
|
|
+ [ '[]10' ]
|
|
|
], { headingRows: 2 } ) );
|
|
], { headingRows: 2 } ) );
|
|
|
|
|
|
|
|
command.execute();
|
|
command.execute();
|
|
|
|
|
|
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
|
|
|
- [ '00', '[]01' ],
|
|
|
|
|
- [ '10', '' ]
|
|
|
|
|
|
|
+ [ '00', '01' ],
|
|
|
|
|
+ [ '[]10', '' ]
|
|
|
], { headingRows: 1 } ) );
|
|
], { headingRows: 1 } ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|