|
| 1 | +/** |
| 2 | + * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors |
| 3 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + */ |
| 5 | + |
| 6 | +import { expect, mergeTests } from '@playwright/test' |
| 7 | +import { test as editorTest } from '../support/fixtures/editor' |
| 8 | +import { test as uploadFileTest } from '../support/fixtures/upload-file' |
| 9 | + |
| 10 | +const test = mergeTests(editorTest, uploadFileTest) |
| 11 | + |
| 12 | +test.describe('Tab navigation inside table cell', () => { |
| 13 | + test('indents list item inside table cell', async ({ editor, open }) => { |
| 14 | + await open() |
| 15 | + await editor.getMenu('Table').click() |
| 16 | + |
| 17 | + const firstCell = editor.content.locator('table td').first() |
| 18 | + await firstCell.click() |
| 19 | + await editor.type('- one') |
| 20 | + await editor.content.press('Enter') |
| 21 | + await editor.type('two') |
| 22 | + |
| 23 | + await editor.content.press('Tab') |
| 24 | + |
| 25 | + const nested = firstCell.locator('ul > li').first().locator('ul > li') |
| 26 | + await expect(nested).toHaveText('two') |
| 27 | + |
| 28 | + await editor.content.press('Shift+Tab') |
| 29 | + await expect(firstCell.locator('> ul > li')).toHaveCount(2) |
| 30 | + await expect(firstCell.locator('> ul > li > ul')).toHaveCount(0) |
| 31 | + }) |
| 32 | + |
| 33 | + test('navigates cells when caret is not inside a list', async ({ editor, open }) => { |
| 34 | + await open() |
| 35 | + await editor.getMenu('Table').click() |
| 36 | + |
| 37 | + const header = editor.content.locator('table th').first() |
| 38 | + await header.click() |
| 39 | + await editor.type('h1') |
| 40 | + await editor.content.press('Tab') |
| 41 | + await editor.type('h2') |
| 42 | + |
| 43 | + const headers = editor.content.locator('table th') |
| 44 | + await expect(headers.nth(0)).toContainText('h1') |
| 45 | + await expect(headers.nth(0)).toContainText('h1') |
| 46 | + }) |
| 47 | +}) |
0 commit comments