From dc8386ab35e3701ccf79c6f242012329196ec8d4 Mon Sep 17 00:00:00 2001 From: umaranis Date: Mon, 15 May 2023 17:52:34 +1000 Subject: [PATCH] test: fix tables Webkit e2e --- .../src/__tests__/e2e/Tables.spec.mjs | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/demos/playground/src/__tests__/e2e/Tables.spec.mjs b/demos/playground/src/__tests__/e2e/Tables.spec.mjs index 41f79c7..ebfa524 100644 --- a/demos/playground/src/__tests__/e2e/Tables.spec.mjs +++ b/demos/playground/src/__tests__/e2e/Tables.spec.mjs @@ -16,6 +16,7 @@ import { } from '../keyboardShortcuts/index.mjs'; import { assertHTML, + assertSelection, click, clickSelectors, copyToClipboard, @@ -1007,7 +1008,6 @@ test.describe('Tables', () => { true, ); await mergeTableCells(page); - await page.pause(); await moveRight(page, 1); await selectCellsFromTableCords( @@ -1018,7 +1018,6 @@ test.describe('Tables', () => { true, ); await mergeTableCells(page); - await page.pause(); await selectCellsFromTableCords( page, @@ -1027,7 +1026,6 @@ test.describe('Tables', () => { true, true, ); - await page.pause(); await assertHTML( page, @@ -1253,7 +1251,6 @@ test.describe('Tables', () => { ); await mergeTableCells(page); - await page.pause(); await selectCellsFromTableCords( page, {x: 0, y: 0}, @@ -1313,7 +1310,6 @@ test.describe('Tables', () => { ); await mergeTableCells(page); - await page.pause(); await selectCellsFromTableCords( page, {x: 0, y: 0}, @@ -1321,10 +1317,8 @@ test.describe('Tables', () => { true, true, ); - await page.pause(); await deleteTableColumns(page); - await page.pause(); await assertHTML( page, @@ -1351,4 +1345,32 @@ test.describe('Tables', () => { `, ); }); + + test('Deselect when click outside #3785 #4138', async ({ + page, + isPlainText, + }) => { + test.skip(isPlainText); + if (IS_COLLAB) { + // The contextual menu positioning needs fixing (it's hardcoded to show on the right side) + page.setViewportSize({height: 1000, width: 3000}); + } + + await focusEditor(page); + + await page.keyboard.type('123'); + await insertTable(page, 1, 1); + await selectAll(page); + + await page.pause(); + await click(page, 'div[contenteditable="true"] p:first-of-type'); + await page.pause(); + + await assertSelection(page, { + anchorOffset: 3, + anchorPath: [0, 0, 0], + focusOffset: 3, + focusPath: [0, 0, 0], + }); + }); });