* 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
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
|
|
import { CanvasHelper } from '#tests/helpers/canvas'
|
|
|
|
test('keyboard switches document tabs and middle-click closes an inactive tab', async ({
|
|
page
|
|
}) => {
|
|
await page.goto('/?test')
|
|
await new CanvasHelper(page).waitForInit()
|
|
await page.getByTestId('tabbar-new').click()
|
|
const tabs = page.getByTestId('tabbar-tab')
|
|
await tabs.first().focus()
|
|
await tabs.first().press('ArrowRight')
|
|
await expect(tabs.last()).toBeFocused()
|
|
await expect(tabs.last()).toHaveAttribute('aria-selected', 'true')
|
|
await tabs.first().click({ button: 'middle' })
|
|
await expect(tabs).toHaveCount(1)
|
|
await expect(page.getByTestId('recent-files-home')).toBeVisible()
|
|
})
|
|
|
|
test('closing an inactive document tab does not select it', async ({ page }) => {
|
|
await page.goto('/?test')
|
|
await new CanvasHelper(page).waitForInit()
|
|
await page.getByTestId('tabbar-new').click()
|
|
const tabs = page.getByRole('tablist').filter({ has: page.getByTestId('tabbar-tab') })
|
|
await expect(tabs.getByRole('tab')).toHaveCount(2)
|
|
await expect(tabs.getByRole('tab').last()).toHaveAttribute('aria-selected', 'true')
|
|
await page.locator('[data-slot="tab-item"]').first().hover()
|
|
await page
|
|
.locator('[data-slot="tab-item"]')
|
|
.first()
|
|
.getByRole('button', { name: /Close/ })
|
|
.click()
|
|
await expect(tabs.getByRole('tab')).toHaveCount(1)
|
|
await expect(page.getByTestId('recent-files-home')).toBeVisible()
|
|
})
|