import { UnitTest } 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';
UnitTest.test('SplitCellOperationsTest', () => {
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'
' +
'| A1 | B1 |
' +
'| ? |
' +
'| A2 | B2 |
' +
'
',
'',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'',
'',
TableOperations.splitCellIntoColumns, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'' +
'| A1 | B1 |
' +
'| ? |
' +
'| A2 | B2 |
' +
'
',
'',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'' +
'| A1 | B1 |
' +
'| ? |
' +
'| A2 | B2 |
' +
'
',
'',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'' +
'| A1 | B1 |
' +
'| ? |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 1, row: 0, column: 0 }),
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'| ? |
' +
'
',
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
TableOperations.splitCellIntoRows, 1, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 0, row: 0, column: 0 }),
'' +
'| A1 | ? | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
TableOperations.splitCellIntoColumns, 0, 0, 0
);
Assertions.checkOld(
'TBA',
Optional.some({ section: 1, row: 0, column: 0 }),
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | ? | B2 |
' +
'
',
'' +
'| A1 | B1 |
' +
'' +
'' +
'| A2 | B2 |
' +
'
',
TableOperations.splitCellIntoColumns, 1, 0, 0
);
Assertions.checkOld(
'TINY-6765: Check that selected cell in locked column cannot be split into rows',
Optional.none(),
'',
'',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TINY-6765: Check that selected cell in locked column cannot be split into columns',
Optional.none(),
'',
'',
TableOperations.splitCellIntoColumns, 0, 0, 1
);
Assertions.checkOld(
'TINY-6765: Check that selected cell can be split into rows with locked column in table',
Optional.none(),
'' +
'| A1 | B1 |
' +
'| ? |
' +
'| A2 | B2 |
' +
'
',
'',
TableOperations.splitCellIntoRows, 0, 0, 0
);
Assertions.checkOld(
'TINY-6765: Check that selected cell can be split into columns with locked column in table',
Optional.none(),
'',
'',
TableOperations.splitCellIntoColumns, 0, 0, 0
);
});