import { Editor } from '@tiptap/core' import Document from '@tiptap/extension-document' import Paragraph from '@tiptap/extension-paragraph' import { TableKit } from '@tiptap/extension-table' import Text from '@tiptap/extension-text' import { afterEach, beforeEach, describe, expect, it } from 'vite-plus/test' const collectCellPositions = (editor: Editor): number[] => { const positions: number[] = [] editor.state.doc.descendants((node, pos) => { if (node.type.name === 'tableCell' || node.type.name === 'tableHeader') { positions.push(pos) } }) return positions } const getCellContents = (editor: Editor): string[] => { const contents: string[] = [] editor.state.doc.descendants(node => { if (node.type.name === 'tableCell' || node.type.name === 'tableHeader') { contents.push(node.textContent) } }) return contents } describe('deleteSelection with CellSelection', () => { let editor: Editor beforeEach(() => { const element = document.createElement('div') document.body.appendChild(element) editor = new Editor({ element, extensions: [Document, Paragraph, Text, TableKit], content: '
| A1 | B1 | C1 |
| A2 | B2 | C2 |