feat(editor): one tab order, vertical Plus list with the error count

This commit is contained in:
bchanot committed 2026-11-15 15:52:28 +01:00
1 parent b41c24b29d
commit ff21b0315e
11 files changed
+155 -75

No files matched your search

+26 -4
View File
@@ -49,7 +49,7 @@ function Page({
/>
<button type="button">outside</button>
</div>
<button type="button" onClick={() => setActive('general')}>
<button type="button" onClick={() => setActive('findings')}>
elsewhere
</button>
</div>
@@ -92,11 +92,33 @@ describe('the overlay', () => {
expect(more()).toHaveAttribute('aria-expanded', 'false')
await gone()
await user.click(more())
await user.click(screen.getByRole('tab', { name: 'Vérification' }))
await user.click(screen.getByRole('tab', { name: 'Général' }))
expect(more()).toHaveAttribute('aria-expanded', 'false')
})
})
describe('the vertical list', () => {
it('stacks the entries in tab order, the active one marked', async () => {
const { user } = mount()
await user.click(more())
expect(list()).toHaveClass('flex-col')
const rows = [...list()!.querySelectorAll('button')]
expect(rows.map((row) => row.id)).toEqual([
'editor-tab-findings',
'editor-tab-references',
'editor-tab-verification',
])
expect(list()!.querySelector('[aria-current]')).toBeNull()
rows.forEach((row) => expect(row).toHaveClass('min-h-12', 'w-full'))
await user.click(rows[0])
await user.click(more())
const current = list()!.querySelectorAll('[aria-current="true"]')
expect(current).toHaveLength(1)
expect(current[0].id).toBe('editor-tab-findings')
expect(current[0].querySelector('svg')).not.toBeNull()
})
})
describe('the panel takes the focus after a pick', () => {
it('Enter on an entry focuses the panel of that tab once the list is gone', async () => {
const { user } = mount()
@@ -184,8 +206,8 @@ describe('outside presses', () => {
it('a press inside the row closes the menu and goes on to act', async () => {
const { user } = mount()
await user.click(more())
await user.click(screen.getByRole('tab', { name: 'Vérification' }))
expect(screen.getByRole('tab', { name: 'Vérification' })).toHaveAttribute(
await user.click(screen.getByRole('tab', { name: 'Général' }))
expect(screen.getByRole('tab', { name: 'Général' })).toHaveAttribute(
'aria-selected',
'true',
)