openpencil/tests/e2e/toolbar/keyboard.spec.ts
Danila Poyarkov e69ba75c12
refactor(ui): compose shared editor controls (#670)
* refactor(ui): extract shared action and navigation primitives

* refactor(ui): compose settings and libraries with shared tabs

* feat(ui): preserve native activation and toolbar keyboard navigation

* refactor(home): share document entries and accessible input controls

* fix(layers): share virtualized row geometry and selection styling

* refactor(layout): compose spacing and readable dimension controls

* refactor(properties): compose advanced strokes and inline effects

* refactor(ui): reuse actions in page and property controls

* refactor(settings): adopt shared actions without changing workflows

* refactor(ui): share collaboration and provider actions

* refactor(ui): finish shell and paint action composition

* test(ui): restore extracted control and settings coverage

* test(ui): complete workflow extraction coverage

* fix(ui): address review and trim redundant snapshots

* fix(layout): preserve single-step Undo for guides and wrap
2026-09-10 12:09:06 +03:00

26 lines
960 B
TypeScript

import { expect, test } from '@playwright/test'
import { CanvasHelper } from '#tests/helpers/canvas'
test('toolbar arrows move focus without selecting a tool', async ({ page }) => {
await page.goto('/?test')
const canvas = new CanvasHelper(page)
await canvas.waitForInit()
const toolbar = page.getByTestId('toolbar')
await expect(toolbar).toHaveAttribute('role', 'toolbar')
const buttons = toolbar.getByRole('button')
const first = buttons.first()
await first.focus()
const previousTool = await page.evaluate(() => window.openPencil?.getStore?.().state.activeTool)
await first.press('ArrowRight')
await expect(buttons.nth(1)).toBeFocused()
expect(await page.evaluate(() => window.openPencil?.getStore?.().state.activeTool)).toBe(
previousTool
)
await buttons.nth(1).press('End')
await expect(buttons.last()).toBeFocused()
await buttons.last().press('Home')
await expect(first).toBeFocused()
canvas.assertNoErrors()
})