import { context, describe, it } from '@ephox/bedrock-client'; import { Optional } from '@ephox/katamari'; import * as TableOperations from 'ephox/snooker/api/TableOperations'; import * as Assertions from 'ephox/snooker/test/Assertions'; describe('browser.snooker.InsertMultipleOperationsTest', () => { context('insertColumnsBefore', () => { it('TBA: the same number of columns are inserted that are selected', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 1 }), '' + '' + '' + '
A1??B1C1
A2??B2C2
', '' + '' + '' + '
A1B1C1
A2B2C2
', TableOperations.insertColumnsBefore, [ { section: 0, row: 0, column: 1 }, { section: 0, row: 0, column: 2 } ] ); }); it('TBA: the same number of columns are inserted when the range selection includes a colspan', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 1 }), '' + '' + '' + '
A1??B1
A2??B2C2
', '' + '' + '' + '
A1B1
A2B2C2
', TableOperations.insertColumnsBefore, [ { section: 0, row: 0, column: 1 }, { section: 0, row: 1, column: 2 } ] ); }); it('TINY-6906: copy each individual column when inserting new columns', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 0 }), '' + '' + '' + '
??A1B1
??A2B2
', '' + '' + '' + '
A1B1
A2B2
', TableOperations.insertColumnsBefore, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 1 } ] ); }); }); context('insertColumnsAfter', () => { it('TBA: the same number of columns are inserted that are selected', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 2 }), '' + '' + '' + '
A1B1??C1
A2B2??C2
', '' + '' + '' + '
A1B1C1
A2B2C2
', TableOperations.insertColumnsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 0, column: 1 } ] ); }); it('TBA: the same number of columns are inserted when the range selection includes a colspan', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 1 }), '' + '' + '' + '
A1??C1
A2B2??C2
', '' + '' + '' + '
A1C1
A2B2C2
', TableOperations.insertColumnsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 1 } ] ); }); it('TINY-6906: copy each individual column when inserting new columns', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 2 }), '' + '' + '' + '
A1B1??
A2B2??
', '' + '' + '' + '
A1B1
A2B2
', TableOperations.insertColumnsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 1 } ] ); }); }); context('insertRowsBefore', () => { it('TBA: the same number of rows are inserted that are selected', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 1, column: 0 }), '' + '' + '' + '' + '' + '' + '
A1B1
??
??
A2B2
A3B3
', '' + '' + '' + '' + '
A1B1
A2B2
A3B3
', TableOperations.insertRowsBefore, [ { section: 0, row: 1, column: 0 }, { section: 0, row: 2, column: 0 } ] ); }); it('TBA: the same number of rows are inserted when the range selection includes a rowspan', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 1, column: 0 }), '' + '' + '' + '' + '' + '' + '
A1B1
??
??
A2B2
B3
', '' + '' + '' + '' + '
A1B1
A2B2
B3
', TableOperations.insertRowsBefore, [ { section: 0, row: 1, column: 0 }, { section: 0, row: 2, column: 0 } ] ); }); it('TINY-6906: copy each individual rows when inserting new rows', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 0, column: 0 }), '' + '' + '' + '' + '' + '
??
??
A1B1
A2B2
', '' + '' + '' + '
A1B1
A2B2
', TableOperations.insertRowsBefore, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 1 } ] ); }); }); context('insertRowsAfter', () => { it('TBA: the same number of rows are inserted that are selected', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 2, column: 0 }), '' + '' + '' + '' + '' + '' + '
A1B1
A2B2
??
??
A3B3
', '' + '' + '' + '' + '
A1B1
A2B2
A3B3
', TableOperations.insertRowsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ] ); }); it('TBA: the same number of rows are inserted when the range selection includes a rowspan', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 2, column: 0 }), '' + '' + '' + '' + '' + '' + '
A1B1
B2
??
??
A3B3
', '' + '' + '' + '' + '
A1B1
B2
A3B3
', TableOperations.insertRowsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ] ); }); it('TINY-6906: copy each individual row when inserting new rows', () => { Assertions.checkOldMultiple('', Optional.some({ section: 0, row: 2, column: 0 }), '' + '' + '' + '' + '' + '
A1B1
A2B2
??
??
', '' + '' + '' + '
A1B1
A2B2
', TableOperations.insertRowsAfter, [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 1 } ] ); }); }); });