diff --git a/packages/core/src/blocks/TableBlockContent/TableBlockContent.ts b/packages/core/src/blocks/TableBlockContent/TableBlockContent.ts index 9410d1e8be..fbcac8e379 100644 --- a/packages/core/src/blocks/TableBlockContent/TableBlockContent.ts +++ b/packages/core/src/blocks/TableBlockContent/TableBlockContent.ts @@ -170,11 +170,8 @@ const TableParagraph = createStronglyTypedTiptapNode({ ]; }, - renderHTML({ node, HTMLAttributes }) { - // Insert a line break if there is no content, in order to preserve the - // correct cell height. Otherwise, the cell will have a height of zero + - // padding. - return ["p", HTMLAttributes, node.childCount ? 0 : ["br"]]; + renderHTML({ HTMLAttributes }) { + return ["p", HTMLAttributes, 0]; }, }); diff --git a/packages/core/src/editor/editor.css b/packages/core/src/editor/editor.css index 407b1262c8..df24843ef9 100644 --- a/packages/core/src/editor/editor.css +++ b/packages/core/src/editor/editor.css @@ -176,6 +176,11 @@ Tippy popups that are appended to document.body directly text-align: left; } +.bn-editor [data-content-type="table"] th > p, +.bn-editor [data-content-type="table"] td > p { + min-height: 1.5rem; +} + /* tiptap uses colwidth instead of data-colwidth, se we need to adjust this style from prosemirror-tables */ .ProseMirror td, .ProseMirror th { diff --git a/tests/src/end-to-end/tables/tables.test.ts b/tests/src/end-to-end/tables/tables.test.ts new file mode 100644 index 0000000000..4d11d597e6 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts @@ -0,0 +1,52 @@ +import { test } from "../../setup/setupScript.js"; +import { BASE_URL } from "../../utils/const.js"; +import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor.js"; +import { executeSlashCommand } from "../../utils/slashmenu.js"; + +test.beforeEach(async ({ page }) => { + await page.goto(BASE_URL); +}); + +test.describe("Check Table interactions", () => { + test("Should be able to type in cell", async ({ page }) => { + await focusOnEditor(page); + await executeSlashCommand(page, "table"); + await page.keyboard.type("Table Cell"); + + await compareDocToSnapshot(page, "cellTyping.json"); + }); + test("Tab should cycle cells", async ({ page }) => { + await focusOnEditor(page); + await executeSlashCommand(page, "table"); + // Cycle to sixth (last) cell. + for (let i = 0; i < 5; i++) { + await page.keyboard.press("Tab"); + } + await page.keyboard.type("Table Cell"); + // Cycle back to first cell. + for (let i = 0; i < 5; i++) { + await page.keyboard.press("Shift+Tab"); + } + await page.keyboard.type("Table Cell"); + + await compareDocToSnapshot(page, "tabCells.json"); + }); + test("Arrow keys should move cells", async ({ page }) => { + await focusOnEditor(page); + await executeSlashCommand(page, "table"); + // Move down to second (last) cell in column and third (last) cell in row. + page.keyboard.press("ArrowDown"); + for (let i = 0; i < 2; i++) { + await page.keyboard.press("ArrowRight"); + } + await page.keyboard.type("Table Cell"); + // Cycle back to first cell. + page.keyboard.press("ArrowUp"); + for (let i = 0; i < 2; i++) { + await page.keyboard.press("ArrowLeft"); + } + await page.keyboard.type("Table Cell"); + + await compareDocToSnapshot(page, "arrowKeyCells.json"); + }); +}); diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-chromium-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-chromium-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-chromium-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-firefox-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-firefox-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-firefox-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-webkit-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-webkit-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/arrowKeyCells-json-webkit-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-chromium-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-chromium-linux.json new file mode 100644 index 0000000000..fbd2cfd7d9 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-chromium-linux.json @@ -0,0 +1,153 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-firefox-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-firefox-linux.json new file mode 100644 index 0000000000..fbd2cfd7d9 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-firefox-linux.json @@ -0,0 +1,153 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-webkit-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-webkit-linux.json new file mode 100644 index 0000000000..fbd2cfd7d9 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/cellTyping-json-webkit-linux.json @@ -0,0 +1,153 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-chromium-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-chromium-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-chromium-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-firefox-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-firefox-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-firefox-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-webkit-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-webkit-linux.json new file mode 100644 index 0000000000..262b827f38 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/tabCells-json-webkit-linux.json @@ -0,0 +1,159 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "table", + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Table Cell" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1", + "textColor": "default", + "backgroundColor": "default" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/utils/const.ts b/tests/src/utils/const.ts index 21b5d9a95e..58a9bc44ec 100644 --- a/tests/src/utils/const.ts +++ b/tests/src/utils/const.ts @@ -28,6 +28,7 @@ export const NUMBERED_LIST_SELECTOR = `[data-content-type="numberedListItem"]`; export const BULLET_LIST_SELECTOR = `[data-content-type="bulletListItem"]`; export const PARAGRAPH_SELECTOR = `[data-content-type="paragraph"]`; export const IMAGE_SELECTOR = `[data-content-type="image"]`; +export const TABLE_SELECTOR = `[data-content-type="table"]`; export const DRAG_HANDLE_SELECTOR = `[data-test="dragHandle"]`; export const DRAG_HANDLE_ADD_SELECTOR = `[data-test="dragHandleAdd"]`;