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('removeColumn command', () => { it('should remove column included col-spanning cell(normal single cell)', () => { editor.setSelection(85, 85); // select [2, 0] cell(mergedCell2-1 text) editor.exec('removeColumn'); const expected = oneLineTrim`

mergedHead1

mergedHead2

mergedCell1-1

cell1-2

mergedCell1-3

mergedCell2-2

cell2-3

cell3-1

cell4

cell4-3

cell5-2

cell5-3

`; assertWYSIWYGHTML(editor, expected); }); it('should remove column(normal single cell)', () => { editor.setSelection(102, 102); // select [2, 1] cell(mergedCell2-2 text) editor.exec('removeColumn'); const expected = oneLineTrim`

mergedHead1

mergedHead2

mergedCell1-1

cell1-2

mergedCell1-3

mergedCell2-1

cell2-3

cell3-1

cell4-1

cell4-3

cell5-1

cell5-3

`; assertWYSIWYGHTML(editor, expected); }); it('should remove column(selected col-spanning cell)', () => { editor.setSelection(38, 38); // select [1, 0] cell(mergedCell1-1 text) editor.exec('removeColumn'); const expected = oneLineTrim`

mergedHead2

cell1-2

mergedCell1-3

cell2-3

cell3-1

cell4-3

cell5-3

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