fix(editor): Task 2 review round 1, trace calls, form hooks, keyboard proof
This commit is contained in:
1 parent
c893dec60b
commit
b703333b20
15 files changed
+476
-261
No files matched your search
@@ -13,6 +13,8 @@ import type {
|
||||
AnatomicalSheetDocument,
|
||||
ElementKey,
|
||||
} from '@faunosteo/core-wasm/types'
|
||||
import { findingLayerOf } from '@/editor/findingLayer'
|
||||
import { testLayer } from '../helpers/findingsHost'
|
||||
import FindingsTab from '@/components/editor/tabs/FindingsTab'
|
||||
import RegionsSection from '@/components/editor/annotations/sections/RegionsSection'
|
||||
import EditorTabBody from '@/components/editor/EditorTabBody'
|
||||
@@ -115,7 +117,7 @@ describe('focus requests', () => {
|
||||
zone_id: 'zone-a',
|
||||
path: ['fcat-a', 'node-a'],
|
||||
}
|
||||
render(<FindingsTab {...base} focus={request(key)} />)
|
||||
render(<FindingsTab {...base} layer={testLayer} focus={request(key)} />)
|
||||
const item = await screen.findByRole('treeitem', { name: /Nœud A/ })
|
||||
expect(item.getAttribute('aria-selected')).toBe('true')
|
||||
await waitFor(() => expect(document.activeElement).toBe(item))
|
||||
@@ -210,7 +212,7 @@ describe('focus requests', () => {
|
||||
const gone: ElementKey = { kind: 'zone', id: 'zone-gone' }
|
||||
render(
|
||||
<FocusConsumedContext value={consumed}>
|
||||
<FindingsTab {...base} focus={request(gone, 4)} />
|
||||
<FindingsTab {...base} layer={testLayer} focus={request(gone, 4)} />
|
||||
</FocusConsumedContext>,
|
||||
)
|
||||
await waitFor(() => expect(consumed).toHaveBeenCalledWith(4, 'none'))
|
||||
@@ -268,7 +270,7 @@ function Probe({ go, tier }: { go: EditorTarget; tier: 'wide' | 'small' }) {
|
||||
visited={state.visitedTabs}
|
||||
{...base}
|
||||
navigate={nav.navigate}
|
||||
openCitations={nav.openCitations}
|
||||
layer={findingLayerOf(nav)}
|
||||
focus={state.focus}
|
||||
annotations={{
|
||||
section: state.section,
|
||||
@@ -388,6 +390,9 @@ describe('a request that finds nothing', () => {
|
||||
const key: ElementKey = { kind: 'zone', id: 'zone-a' }
|
||||
render(<Probe go={targetOfKey(key)} tier="wide" />)
|
||||
await user.click(screen.getByText('go'))
|
||||
// « Aller à » opens the element's dialog; closed, its row holds the focus.
|
||||
const dialog = await screen.findByRole('dialog')
|
||||
await user.click(within(dialog).getByRole('button', { name: 'Fermer' }))
|
||||
await waitFor(() =>
|
||||
expect(document.activeElement).toBe(
|
||||
screen.getByRole('treeitem', { name: /Zone A/ }),
|
||||
|
||||
Reference in new issue
Block a user