feat(editor): one tab order, vertical Plus list with the error count
This commit is contained in:
1 parent
b41c24b29d
commit
ff21b0315e
11 files changed
+155
-75
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
draftPath,
|
||||
draftTitle,
|
||||
editorActor,
|
||||
morePlus,
|
||||
pointOf,
|
||||
seedDraft,
|
||||
shapeWith,
|
||||
@@ -40,8 +41,7 @@ async function openAt(page: Page, width: number, height = 800) {
|
||||
).toBeVisible()
|
||||
}
|
||||
|
||||
const more = (page: Page) =>
|
||||
page.getByRole('button', { name: dict['editor.tab.more'], exact: true })
|
||||
const more = (page: Page) => morePlus(page, dict)
|
||||
const list = (page: Page) => page.locator('#editor-tabs-more')
|
||||
|
||||
/** The boxes that must not move when « Plus » opens: the row, the page below it, the document. */
|
||||
@@ -90,6 +90,41 @@ test.describe('« Plus » dropdown', () => {
|
||||
})
|
||||
}
|
||||
|
||||
for (const width of [375, 320]) {
|
||||
test(`at ${width} px the entries stack in tab order inside the viewport`, async ({
|
||||
page,
|
||||
}) => {
|
||||
await openAt(page, width)
|
||||
await expect(page.getByRole('tablist').getByRole('tab')).toHaveText([
|
||||
dict['editor.tab.general'],
|
||||
dict['editor.tab.annotations'],
|
||||
])
|
||||
await more(page).click()
|
||||
const rows = list(page).getByRole('button')
|
||||
await expect(rows).toHaveCount(3)
|
||||
// Vérification may carry its error count.
|
||||
await expect(rows).toHaveText([
|
||||
dict['editor.tab.findings'],
|
||||
dict['editor.tab.references'],
|
||||
new RegExp(`^${dict['editor.tab.verification']}`),
|
||||
])
|
||||
const boxes = await rows.evaluateAll((els) =>
|
||||
els.map((el) => el.getBoundingClientRect().toJSON()),
|
||||
)
|
||||
boxes.forEach((box, at) => {
|
||||
expect(box.height, `row ${at} height`).toBeGreaterThanOrEqual(44)
|
||||
expect(box.x, `row ${at} left`).toBeGreaterThanOrEqual(0)
|
||||
expect(box.right, `row ${at} right`).toBeLessThanOrEqual(width)
|
||||
if (at > 0) {
|
||||
expect(box.y, `row ${at} below`).toBeGreaterThanOrEqual(
|
||||
boxes[at - 1].bottom,
|
||||
)
|
||||
}
|
||||
})
|
||||
await expectAccessible(page, `« Plus » list at ${width} px`)
|
||||
})
|
||||
}
|
||||
|
||||
test('closes on a selection, outside tap and Escape, focus kept sane', async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
Reference in new issue
Block a user