import { UnitTest } from '@ephox/bedrock-client'; import * as Assertions from 'ephox/snooker/test/Assertions'; UnitTest.test('MergeOperationsTest', () => { Assertions.checkMerge( 'SimpleCase - merging textnodes should move all content into the first cell separarted by BRs', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '
a
d
bc
ef
ghi
', '' + '' + '' + '' + '
abc
def
ghi
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'SimpleCase - merging textnodes should move all content into the first cell separarted by BRs', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '
a
d
bc
ef
ghi
jkl
', '' + '' + '' + '' + '' + '' + '' + '
abc
def
ghi
jkl
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'SimpleCase - merging textnodes should move all content into the first cell separarted by BRs', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '
abc
def
g
j
hi
kl
', '' + '' + '' + '' + '' + '' + '' + '
abc
def
ghi
jkl
', [ { section: 1, row: 0, column: 0 }, { section: 1, row: 1, column: 0 } ], { startRow: 2, startCol: 0, finishRow: 3, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6484 - merge cells where there is one or more row-scopes, resulting in a rowgroup scope.', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1
A2
B1C1
B2C2
', '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1B1C1
A2B2C2
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6484 - merge cells where there is one or more col-scopes, resulting in a colgroup scope.', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1
B1
C1
A2B2C2
', '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1B1C1
A2B2C2
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 0, column: 1 } ], { startRow: 0, startCol: 0, finishRow: 0, finishCol: 1 } ); Assertions.checkMerge( 'TINY-6484 - merge cells where there is one or more row-scopes and one or more col-scopes, resulting in the scope attribute being removed.', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1
A2
B1C1
B2C2
', '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1B1C1
A2B2C2
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6484 - merge cells where there is one or more row-scopes and one or more col-scopes, resulting in the scope attribute being removed, reverse order.', // Border = 1 would be here, but it is removed so that we can assert html '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1
A2
B1C1
B2C2
', '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
A1B1C1
A2B2C2
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6765 - merging cells in different rows that are part of a locked column should be noop', '' + '' + '' + '' + '
abc
def
ghi
', '' + '' + '' + '' + '
abc
def
ghi
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6765 - merging cells in different columns that are part of a locked column should be noop', '' + '' + '' + '' + '
abc
def
ghi
', '' + '' + '' + '' + '
abc
def
ghi
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 0, column: 1 }, { section: 0, row: 0, column: 2 } ], { startRow: 0, startCol: 0, finishRow: 0, finishCol: 2 } ); Assertions.checkMerge( 'TINY-6765 - merging cells in different rows with a locked column in the table but not selected should not affect merging (0)', '' + '' + '' + '' + '
a
d
bc
ef
ghi
', '' + '' + '' + '' + '
abc
def
ghi
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 1, column: 0 } ], { startRow: 0, startCol: 0, finishRow: 1, finishCol: 0 } ); Assertions.checkMerge( 'TINY-6765 - merging cells in different rows and columns with a locked column in the table but not selected should not affect merging (1)', '' + '' + '' + '' + '
a
b
d
e
g
h
c
f
i
', '' + '' + '' + '' + '
abc
def
ghi
', [ { section: 0, row: 0, column: 0 }, { section: 0, row: 0, column: 1 }, { section: 0, row: 1, column: 0 }, { section: 0, row: 1, column: 1 }, { section: 0, row: 2, column: 0 }, { section: 0, row: 2, column: 1 } ], { startRow: 0, startCol: 0, finishRow: 2, finishCol: 1 } ); });