import { oneLineTrim } from 'common-tags'; import Editor from '@toast-ui/editor'; import { assertWYSIWYGHTML, createEditor } from './helper/utils'; let container: HTMLElement, editor: Editor; beforeEach(() => { const editorInfo = createEditor(); container = editorInfo.container; editor = editorInfo.editor; }); afterEach(() => { editor.destroy(); document.body.removeChild(container); }); describe('removeRow command', () => { it('should remove row included row-spanning cell(normal single cell)', () => { editor.setSelection(119, 119); // select [2, 2] cell(cell2-3 text) editor.exec('removeRow'); const expected = oneLineTrim`

mergedHead1

mergedHead2

mergedCell1-1

cell1-2

mergedCell1-3

mergedCell2-1

mergedCell2-2

cell3-1

cell4-1

cell4

cell4-3

cell5-1

cell5-2

cell5-3

`; assertWYSIWYGHTML(editor, expected); }); it('should remove row(normal single cell)', () => { editor.setSelection(132, 132); // select [3, 2] cell(cell3-1 text) editor.exec('removeRow'); const expected = oneLineTrim`

mergedHead1

mergedHead2

mergedCell1-1

cell1-2

mergedCell1-3

mergedCell2-1

mergedCell2-2

cell2-3

cell4-1

cell4

cell4-3

cell5-1

cell5-2

cell5-3

`; assertWYSIWYGHTML(editor, expected); }); it('should remove row(selected row-spanning cell)', () => { editor.setSelection(100, 100); // select [2, 1] cell(mergedCell2-2 text) editor.exec('removeRow'); const expected = oneLineTrim`

mergedHead1

mergedHead2

mergedCell1-1

cell1-2

mergedCell1-3

cell4-1

cell4

cell4-3

cell5-1

cell5-2

cell5-3

`; assertWYSIWYGHTML(editor, expected); }); });