feat(editor): four tabs, Annotations sections, references from the header

U1 Lot B1. Four tabs (Général, Annotations, Constats, Vérification); views,
categories and regions become full-width Annotations sections opened from the
overview panel; references move to a header-toggled panel (minimal, Lot D
completes it); « Aller à » goes through EditorTarget and the navigation hook.
EditorWorkspace owns the navigation; DraftHeader split in HeaderActions and
SaveLine; EditorTabs split in TabList and MoreTabs.

R-24, assertions removed or rewritten (file: old -> new):
unit
- editor-route.test: seven tab names -> four; « Plus » at 800 px with
  Références clicked -> no « Plus »; below 640 px five others -> Général,
  Constats, and Constats opens the findings tab; + references panel cases
- editor-route-recovery.test: tab Références + editor-tab-references label ->
  header button + editor-references-panel labelled by its heading
- editor-mode.test: small tier `more` of five -> [general, findings]
- editor-focus-request.test: {key,serial} -> {target,serial}; ReferencesTab and
  VertebraeTab -> ReferencesPanel and RegionsSection; issueTarget tab/key ->
  target place/section/key (vertebrae tab -> annotations/regions); consumed
  context (serial) -> (serial, outcome); annotation case adds heading focus
- editor-verification.test: onGoTo('annotations', key) -> navigate(targetOfKey
  (key), opener); props onSelectTab/onGoTo -> navigate
- editor-annotations-tab.test: props onSelectTab -> navigate + section props;
  no_category text « (onglet Général) » -> « (Annotations, section
  Catégories) »
- editor-tabs-general.test: categories cases render GeneralTab ->
  CategoriesSection(doc); + Général holds no categories editor
- editor-tabs-lists.test: tab imports -> panel and section; read-only
  references « no button » -> only « Fermer les références »
- editor-tabs-views, editor-drawing-upload, editor-repair.test: ViewsTab ->
  ViewsSection import, assertions kept; editor-findings.test: navigate prop
e2e
- support/editor selectTab: exact name -> pattern (error badge in the name);
  + place, openSection, showDrawing, backToDrawing, openReferences, TABS
- support/warm-up: seven tabs -> four + sections + references panel
- editor-access: seven-tab axe loops -> four tabs + three sections + panel
  (edit and read-only); narrow widths add panel overflow and axe
- editor-drawings: tab Vues -> openSection views; tab Annotations ->
  showDrawing
- editor-structures: tab Général (categories) -> openSection categories, axe
  label « general tab » -> « categories section »; tab Références ->
  openReferences/closeReferences; tab Vertèbres -> openSection regions; tab
  Annotations -> showDrawing
- editor-geometry: three tab Vues -> openSection views
- editor-equine: tab Général (categories add) -> openSection categories; five
  tabs loop -> two tabs + sections + panel; tab Annotations -> showDrawing
- editor-journey: tab Vues, tab Général (category), tab Annotations ->
  openSection views/categories, showDrawing; frozen axe scrolls to the header
- lan/trial-lan (not run): tab Vues -> Annotations tab + views entry

Verified: typecheck, lint, vitest 107 files / 1125 tests, whole shell suite on
the sandbox 151 passed, 49 skipped, 0 failed.
This commit is contained in:
bchanot committed 2026-11-06 20:25:35 +01:00
1 parent 95b1b7e461
commit bc2dba7c14
56 files changed
+2419 -699

No files matched your search

@@ -41,7 +41,14 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = {
readOnly: false,
navigate: vi.fn(),
reloadSheet: vi.fn(),
section: 'drawing' as const,
onOpenSection: vi.fn(),
onBack: vi.fn(),
}
const named = (id: string, cx: number, cy: number, r: number) =>
point(id, cx, cy, r)
const annotations = () => store.getState().previewState!.document.annotations
@@ -484,7 +491,7 @@ describe('tools and categories', () => {
expect(screen.getByRole('button', { name: 'Point' })).toBeDisabled()
expect(
screen.getByText(
"Créez d'abord une catégorie d'annotation (onglet Général).",
"Créez d'abord une catégorie d'annotation (Annotations, section Catégories).",
),
).toBeInTheDocument()
})
@@ -10,7 +10,7 @@ import {
import userEvent from '@testing-library/user-event'
import { SheetFailure } from '@faunosteo/supabase'
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
import ViewsTab from '@/components/editor/tabs/ViewsTab'
import ViewsSection from '@/components/editor/annotations/sections/ViewsSection'
import { cleanSvg } from '@/editor/core/cleaning'
import { createHash } from 'node:crypto'
import { getDict } from '@/i18n'
@@ -35,7 +35,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
confirmSheetAssetUpload: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const NEW_ASSET = '22222222-2222-4222-8222-222222222222'
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
@@ -91,7 +91,7 @@ async function pick(text: string, name = 'dessin.svg') {
beforeEach(async () => {
useLocaleStore.setState({ locale: 'fr' })
await openReady()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
})
afterEach(() => {
cleanup()
+1 -1
View File
@@ -29,7 +29,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
const name = (n: string) => ({ fr: n, en: n })
+155 -37
View File
@@ -1,17 +1,25 @@
/** Lot J fix: « Aller à … » seeds each tab's own selection once. */
/** « Aller à … »: each request reaches the place its target names, once, and never lands on body. */
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { useState } from 'react'
import { cleanup, render, screen } from '@testing-library/react'
import { cleanup, render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import type {
AnatomicalSheetDocument,
ElementKey,
} from '@faunosteo/core-wasm/types'
import FindingsTab from '@/components/editor/tabs/FindingsTab'
import ReferencesTab from '@/components/editor/tabs/ReferencesTab'
import VertebraeTab from '@/components/editor/tabs/VertebraeTab'
import RegionsSection from '@/components/editor/annotations/sections/RegionsSection'
import EditorTabBody from '@/components/editor/EditorTabBody'
import EditorTabs from '@/components/editor/EditorTabs'
import ReferencesPanel from '@/components/editor/references/ReferencesPanel'
import AnnotationsTab from '@/components/editor/tabs/AnnotationsTab'
import { FocusConsumedContext, type FocusRequest } from '@/editor/focusRequest'
import {
FocusConsumedContext,
ownedBy,
type FocusRequest,
} from '@/editor/focusRequest'
import { targetOfKey, type EditorTarget } from '@/editor/navigation'
import { useEditorNavigation } from '@/editor/useEditorNavigation'
import { issueTarget } from '@/editor/verification'
import { useLocaleStore } from '@/state/localeStore'
import { edit, insert, point } from '../helpers/editorFixtures'
@@ -32,7 +40,17 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const base = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const base = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const section = {
section: 'drawing' as const,
onOpenSection: vi.fn(),
onBack: vi.fn(),
}
const panel = { open: true, onClose: vi.fn() }
const request = (key: ElementKey, serial = 1): FocusRequest => ({
target: targetOfKey(key),
serial,
})
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
const name = (n: string) => ({ fr: n, en: n })
@@ -90,24 +108,29 @@ describe('focus requests', () => {
zone_id: 'zone-a',
path: ['fcat-a', 'node-a'],
}
render(<FindingsTab {...base} focus={{ key, serial: 1 }} />)
render(<FindingsTab {...base} 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))
})
it('Annotations: selects the annotation of the request', async () => {
it('Annotations: selects the annotation and focuses the properties heading', async () => {
const text = insert(baseText(), point('anno-b', 20, 20, 3))
await openReady({ text })
render(
<AnnotationsTab
{...base}
focus={{ key: { kind: 'annotation', id: 'anno-b' }, serial: 1 }}
{...section}
focus={request({ kind: 'annotation', id: 'anno-b' })}
/>,
)
expect(await screen.findAllByText(/anno-b|Sélection/)).not.toHaveLength(0)
await waitFor(() =>
expect(document.activeElement).toHaveAttribute('data-properties-heading'),
)
})
it('Références and Vertèbres: focus the named row', async () => {
it('Références and Régions: focus the named row', async () => {
let text = insert(baseText(), {
kind: 'reference',
value: {
@@ -129,9 +152,10 @@ describe('focus requests', () => {
})
await openReady({ text })
render(
<ReferencesTab
<ReferencesPanel
{...base}
focus={{ key: { kind: 'reference', id: 'ref-a' }, serial: 1 }}
{...panel}
focus={request({ kind: 'reference', id: 'ref-a' })}
/>,
)
expect(document.activeElement?.getAttribute('data-focus-key')).toContain(
@@ -139,9 +163,9 @@ describe('focus requests', () => {
)
cleanup()
render(
<VertebraeTab
<RegionsSection
{...base}
focus={{ key: { kind: 'region', code: 'C' }, serial: 1 }}
focus={request({ kind: 'region', code: 'C' })}
/>,
)
expect(document.activeElement?.getAttribute('data-focus-key')).toContain(
@@ -161,15 +185,37 @@ describe('focus requests', () => {
},
})
await openReady({ text })
const focus = {
key: { kind: 'reference', id: 'ref-a' } as ElementKey,
serial: 1,
}
const view = render(<ReferencesTab {...base} focus={focus} />)
const focus = request({ kind: 'reference', id: 'ref-a' })
const view = render(<ReferencesPanel {...base} {...panel} focus={focus} />)
;(document.activeElement as HTMLElement).blur()
view.rerender(<ReferencesTab {...base} focus={focus} />)
view.rerender(<ReferencesPanel {...base} {...panel} focus={focus} />)
expect(document.activeElement?.getAttribute('data-focus-key')).toBeNull()
})
it('reports found, or none when the place holds no such element', async () => {
await openReady({ text: findingsText() })
const consumed = vi.fn()
const gone: ElementKey = { kind: 'zone', id: 'zone-gone' }
render(
<FocusConsumedContext value={consumed}>
<FindingsTab {...base} focus={request(gone, 4)} />
</FocusConsumedContext>,
)
await waitFor(() => expect(consumed).toHaveBeenCalledWith(4, 'none'))
})
})
describe('ownedBy', () => {
it('passes a request only to the place its target names', () => {
const view = request({ kind: 'view', id: 'view-main' })
expect(ownedBy(view, 'annotations.views')).toBe(view)
expect(ownedBy(view, 'annotations.drawing')).toBeUndefined()
expect(ownedBy(view, 'general')).toBeUndefined()
const ref = request({ kind: 'reference', id: 'ref-a' })
expect(ownedBy(ref, 'references')).toBe(ref)
expect(ownedBy(ref, 'findings')).toBeUndefined()
expect(ownedBy(undefined, 'general')).toBeUndefined()
})
})
describe('issueTarget', () => {
@@ -178,50 +224,122 @@ describe('issueTarget', () => {
const d = doc()
const path = 'finding_zones[0].categories[0].children[0].reference_ids[1]'
expect(issueTarget(d, path, 'fr')).toMatchObject({
tab: 'findings',
key: { kind: 'finding', zone_id: 'zone-a', path: ['fcat-a', 'node-a'] },
target: {
place: 'tab',
tab: 'findings',
key: { kind: 'finding', zone_id: 'zone-a', path: ['fcat-a', 'node-a'] },
},
name: 'Nœud A',
})
expect(issueTarget(d, 'finding_zones[0]', 'fr')?.key).toEqual({
kind: 'zone',
id: 'zone-a',
expect(issueTarget(d, 'finding_zones[0]', 'fr')?.target).toMatchObject({
key: { kind: 'zone', id: 'zone-a' },
})
expect(
issueTarget(d, 'vertebral_config.regions[3].count_range', 'fr'),
).toMatchObject({
tab: 'vertebrae',
key: null,
target: { tab: 'annotations', section: 'regions', key: null },
})
expect(issueTarget(d, 'nothing', 'fr')).toBeNull()
})
})
/** The route's contract: one tab mounted at a time, the request cleared once consumed. */
function Harness() {
const [tab, setTab] = useState<'references' | 'vertebrae'>('references')
const [focus, setFocus] = useState<FocusRequest | undefined>({
key: { kind: 'reference', id: 'ref-a' },
serial: 1,
/** The workspace's wiring in miniature: the hook, the tab row, the shown body. */
function Probe({ go, tier }: { go: EditorTarget; tier: 'wide' | 'small' }) {
const nav = useEditorNavigation('verification')
const { state } = nav
return (
<FocusConsumedContext value={nav.consumed}>
<EditorTabs active={state.tab} tier={tier} onSelect={nav.selectTab} />
<button onClick={() => nav.navigate(go)}>go</button>
<EditorTabBody
tab={state.tab}
{...base}
navigate={nav.navigate}
focus={ownedBy(state.focus, state.tab)}
annotations={{
section: state.section,
onOpenSection: nav.openSection,
onBack: nav.backToDrawing,
}}
/>
</FocusConsumedContext>
)
}
describe('a request that finds nothing', () => {
const missing: EditorTarget = {
place: 'tab',
tab: 'findings',
section: null,
key: { kind: 'zone', id: 'zone-gone' },
}
it('lands on the tab button, never on body', async () => {
await openReady({ text: findingsText() })
const user = userEvent.setup()
render(<Probe go={missing} tier="wide" />)
await user.click(screen.getByText('go'))
await waitFor(() =>
expect(document.activeElement).toBe(
screen.getByRole('tab', { name: 'Constats' }),
),
)
})
it('below 640 px lands on « Plus » while the tab sits in its closed list', async () => {
await openReady({ text: findingsText() })
const user = userEvent.setup()
render(<Probe go={missing} tier="small" />)
await user.click(screen.getByText('go'))
await waitFor(() =>
expect(document.activeElement).toBe(
screen.getByRole('button', { name: 'Plus' }),
),
)
})
it('a found element keeps the focus it took', async () => {
await openReady({ text: findingsText() })
const user = userEvent.setup()
const key: ElementKey = { kind: 'zone', id: 'zone-a' }
render(<Probe go={targetOfKey(key)} tier="wide" />)
await user.click(screen.getByText('go'))
await waitFor(() =>
expect(document.activeElement).toBe(
screen.getByRole('treeitem', { name: /Zone A/ }),
),
)
})
})
/** The route's contract: one place mounted at a time, the request cleared once consumed. */
function Harness() {
const [shown, setShown] = useState<'references' | 'regions'>('references')
const [focus, setFocus] = useState<FocusRequest | undefined>(
request({ kind: 'reference', id: 'ref-a' }),
)
const clear = (serial: number) =>
setFocus((prev) => (prev?.serial === serial ? undefined : prev))
const Body = tab === 'references' ? ReferencesTab : VertebraeTab
return (
<FocusConsumedContext value={clear}>
<button
onClick={() =>
setTab(tab === 'references' ? 'vertebrae' : 'references')
setShown(shown === 'references' ? 'regions' : 'references')
}
>
switch
</button>
<Body {...base} focus={focus} />
{shown === 'references' ? (
<ReferencesPanel {...base} {...panel} focus={focus} />
) : (
<RegionsSection {...base} focus={focus} />
)}
</FocusConsumedContext>
)
}
describe('a consumed request', () => {
it('is not replayed when the tab is left and reopened', async () => {
it('is not replayed when the place is left and reopened', async () => {
const text = insert(baseText(), {
kind: 'reference',
value: {
+2 -8
View File
@@ -97,7 +97,7 @@ describe('modeAfterSave', () => {
})
describe('tabsFor', () => {
it('the static lists of board 05', () => {
it('the static lists of board 05, four tabs', () => {
expect(tabsFor('wide').more).toEqual([])
expect(tabsFor('medium').shown).toEqual([
'general',
@@ -106,12 +106,6 @@ describe('tabsFor', () => {
'verification',
])
expect(tabsFor('small').shown).toEqual(['annotations', 'verification'])
expect(tabsFor('small').more).toEqual([
'general',
'views',
'findings',
'references',
'vertebrae',
])
expect(tabsFor('small').more).toEqual(['general', 'findings'])
})
})
+3 -3
View File
@@ -13,7 +13,7 @@ import type {
Annotation,
Geometry,
} from '@faunosteo/core-wasm/types'
import ViewsTab from '@/components/editor/tabs/ViewsTab'
import ViewsSection from '@/components/editor/annotations/sections/ViewsSection'
import { cleanSvg } from '@/editor/core/cleaning'
import { attachToView } from '@/editor/drawingUpload'
import { applyRepair, proposeGeometry } from '@/editor/repair'
@@ -36,7 +36,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
confirmSheetAssetUpload: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const NEW_ASSET = '22222222-2222-4222-8222-222222222222'
const t = (key: string) => getDict('fr')[key as never] as string
const doc = (): AnatomicalSheetDocument =>
@@ -297,7 +297,7 @@ const COMPLEX_PATH =
async function pickAndOpenDialog(text = unmeasuredText()) {
await openReady({ text })
serverGets(SVG)
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
const user = userEvent.setup()
const input = screen.getByTestId('view-view-main-file') as HTMLInputElement
await user.upload(input, new File([SVG], 'd.svg', { type: 'image/svg+xml' }))
@@ -90,10 +90,10 @@ describe('the blocking offer', () => {
).toBeEnabled()
expect(useLeaveGuardStore.getState().armed).toBe(true)
// consultation: tabs still switch
await user.click(screen.getByRole('tab', { name: 'Références' }))
expect(screen.getByTestId('editor-tab-references')).toHaveAttribute(
'aria-label',
'Références',
await user.click(screen.getByRole('button', { name: 'Références' }))
expect(screen.getByTestId('editor-references-panel')).toHaveAttribute(
'aria-labelledby',
'editor-references-title',
)
// editing: refused by the store, no save offered
expect(commitMove(40)).toMatchObject({
+62 -28
View File
@@ -43,18 +43,10 @@ afterEach(() => {
const ready = () =>
screen.findByRole('heading', { level: 1, name: 'Brouillon, version 4' })
const TABS = [
'Général',
'Vues et illustrations',
'Annotations',
'Constats',
'Références',
'Vertèbres',
'Vérification',
]
const TABS = ['Général', 'Annotations', 'Constats', 'Vérification']
describe('edit mode', () => {
it('header, badges, the seven tabs, nothing read-only', async () => {
it('header, badges, the four tabs, nothing read-only', async () => {
mountDraft()
await ready()
expect(screen.getByText('Brouillon')).toBeInTheDocument()
@@ -136,8 +128,7 @@ describe('tabs', () => {
expect(screen.getByRole('tabpanel')).toHaveAccessibleName('Constats')
})
it('640 to 1 023 px: four tabs and « Plus »; the others sit under the disclosure', async () => {
const user = userEvent.setup()
it('640 to 1 023 px: the four tabs, no « Plus »', async () => {
mountDraft({ width: 800 })
await ready()
const shown = within(screen.getByRole('tablist')).getAllByRole('tab')
@@ -147,17 +138,10 @@ describe('tabs', () => {
'Constats',
'Vérification',
])
const more = screen.getByRole('button', { name: 'Plus' })
expect(more).toHaveAttribute('aria-expanded', 'false')
expect(screen.queryByRole('button', { name: 'Références' })).toBeNull()
await user.click(more)
expect(more).toHaveAttribute('aria-expanded', 'true')
await user.click(screen.getByRole('button', { name: 'Références' }))
expect(screen.getByTestId('editor-tab-references')).toBeInTheDocument()
expect(more).toHaveAttribute('aria-expanded', 'false')
expect(screen.queryByRole('button', { name: 'Plus' })).toBeNull()
})
it('below 640 px: two tabs and « Plus » listing the five others', async () => {
it('below 640 px: two tabs and « Plus » listing Général and Constats', async () => {
const user = userEvent.setup()
mountDraft({ width: 375 })
await ready()
@@ -169,13 +153,63 @@ describe('tabs', () => {
await user.click(screen.getByRole('button', { name: 'Plus' }))
const more = document.getElementById('editor-tabs-more') as HTMLElement
const rest = within(more).getAllByRole('button')
expect(rest.map((b) => b.textContent)).toEqual([
'Général',
'Vues et illustrations',
'Constats',
'Références',
'Vertèbres',
])
expect(rest.map((b) => b.textContent)).toEqual(['Général', 'Constats'])
await user.click(rest[1])
expect(screen.getByTestId('editor-tab-findings')).toBeInTheDocument()
expect(document.getElementById('editor-tabs-more')).toBeNull()
})
})
describe('references panel', () => {
const button = () => screen.getByRole('button', { name: 'Références' })
it('the header button opens it on its heading and ✕ returns the focus', async () => {
const user = userEvent.setup()
mountDraft()
await ready()
expect(button()).toHaveAttribute('aria-expanded', 'false')
expect(screen.queryByTestId('editor-references-panel')).toBeNull()
await user.click(button())
const panel = screen.getByTestId('editor-references-panel')
expect(panel).toBeVisible()
expect(button()).toHaveAttribute('aria-expanded', 'true')
expect(document.activeElement).toBe(
within(panel).getByRole('heading', { name: 'Références' }),
)
expect(screen.getByRole('tab', { name: 'Annotations' })).toHaveAttribute(
'aria-selected',
'true',
)
await user.click(
within(panel).getByRole('button', { name: 'Fermer les références' }),
)
expect(panel).not.toBeVisible()
expect(document.activeElement).toBe(button())
})
it('Escape inside the panel closes it, the content is kept for the next opening', async () => {
const user = userEvent.setup()
mountDraft()
await ready()
await user.click(button())
const panel = screen.getByTestId('editor-references-panel')
await user.keyboard('{Escape}')
expect(panel).not.toBeVisible()
await user.click(button())
expect(screen.getByTestId('editor-references-panel')).toBe(panel)
expect(panel).toBeVisible()
})
it('read-only: the panel lists the references with no edit control', async () => {
const user = userEvent.setup()
mountDraft({ width: 800 })
await ready()
await user.click(button())
const panel = screen.getByTestId('editor-references-panel')
expect(within(panel).queryByRole('textbox')).toBeNull()
expect(
within(panel).queryByRole('button', { name: 'Ajouter la référence' }),
).toBeNull()
})
})
@@ -0,0 +1,277 @@
/** U1 Lot B1: the Annotations sections, their entries, the view fallback, « Aller à » kept. */
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import {
act,
cleanup,
fireEvent,
render,
screen,
waitFor,
within,
} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import AnnotationsTab from '@/components/editor/tabs/AnnotationsTab'
import {
AnnounceContext,
FocusConsumedContext,
type FocusRequest,
} from '@/editor/focusRequest'
import { targetOfKey } from '@/editor/navigation'
import { useLocaleStore } from '@/state/localeStore'
import { drawnText, insert, point } from '../helpers/editorFixtures'
import {
baseText,
openReady,
resetStore,
serverHas,
store,
} from '../helpers/editorHarness'
import { mountDraft, setWidth } from '../helpers/editorRoute'
vi.mock('@/lib/supabase', () => ({ getSupabaseClient: () => ({}) }))
vi.mock('@faunosteo/supabase', async (orig) => ({
...(await orig<typeof import('@faunosteo/supabase')>()),
getSheetVersion: vi.fn(),
downloadSheetDrawing: vi.fn(),
saveSheetDraft: vi.fn(),
getOfficialSheetAdmin: vi.fn(),
submitSheetReview: vi.fn(),
}))
beforeEach(() => {
useLocaleStore.setState({ locale: 'fr' })
const identity = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }
Object.defineProperty(window.SVGElement.prototype, 'getScreenCTM', {
configurable: true,
value: () => ({ ...identity, inverse: () => identity }),
})
})
afterEach(() => {
cleanup()
resetStore()
setWidth(1024)
})
const ready = () =>
screen.findByRole('heading', { level: 1, name: 'Brouillon, version 4' })
const entry = (name: string | RegExp) => screen.getByRole('button', { name })
const place = (name: string) =>
document.querySelector<HTMLElement>(`[data-place="${name}"]`)
describe('the overview entries', () => {
beforeEach(() => serverHas(baseText(), 3))
it.each([
['Gérer les vues', 'views', 'Vues'],
['Modifier les catégories', 'categories', 'Catégories'],
[/^Régions vertébrales/, 'regions', 'Régions vertébrales'],
] as const)(
'%s opens its section on the heading; « Retour au dessin » refocuses the entry',
async (label, section, title) => {
const user = userEvent.setup()
mountDraft()
await ready()
await user.click(entry(label))
const shown = place(`annotations.${section}`)!
expect(shown).toBeVisible()
expect(document.activeElement).toBe(
within(shown).getByRole('heading', { level: 2, name: title }),
)
expect(screen.getByRole('tab', { name: 'Annotations' })).toHaveAttribute(
'aria-selected',
'true',
)
expect(place('annotations.drawing')).toBeNull()
await user.click(screen.getByRole('button', { name: 'Retour au dessin' }))
expect(place('annotations.drawing')).toBeVisible()
expect(document.activeElement).toHaveAttribute(
'data-section-entry',
section,
)
},
)
it('the regions entry is there with no role code, counting the regions', async () => {
mountDraft()
await ready()
expect(entry('Régions vertébrales (0 région)')).toBeVisible()
})
it('announces the section reached, politely', async () => {
const user = userEvent.setup()
mountDraft()
await ready()
await user.click(entry('Gérer les vues'))
const live = document.querySelector('p[aria-live="polite"]')!
expect(live).toHaveTextContent('Annotations · Vues')
})
it('read-only: the entries read « Voir … » and still open the sections', async () => {
const user = userEvent.setup()
mountDraft({ width: 800 })
await ready()
expect(screen.queryByRole('button', { name: 'Gérer les vues' })).toBeNull()
await user.click(entry('Voir les catégories'))
expect(place('annotations.categories')).toBeVisible()
expect(
within(place('annotations.categories')!).queryByRole('textbox'),
).toBeNull()
await user.click(screen.getByRole('button', { name: 'Retour au dessin' }))
await user.click(entry('Voir les vues'))
expect(place('annotations.views')).toBeVisible()
})
})
const props = {
readOnly: false,
navigate: vi.fn(),
reloadSheet: vi.fn(),
section: 'drawing' as const,
onOpenSection: vi.fn(),
onBack: vi.fn(),
}
const detailView = {
kind: 'view',
value: {
kind: 'detail',
id: 'view-det',
name: { fr: 'Tête', en: 'Head' },
svg_asset_id: null,
view_box: { min_x: 10, min_y: 20, width: 40, height: 60 },
parent_view_id: 'view-main',
},
} as const
const consumed = vi.fn()
const announce = vi.fn()
const Drawing = ({ focus }: { focus?: FocusRequest }) => (
<FocusConsumedContext value={consumed}>
<AnnounceContext value={announce}>
<AnnotationsTab {...props} focus={focus} />
</AnnounceContext>
</FocusConsumedContext>
)
async function mountDrawing(text = drawnText()) {
consumed.mockReset()
announce.mockReset()
await openReady({ text })
const user = userEvent.setup()
const view = render(<Drawing />)
await waitFor(() =>
expect(
screen.getByTestId('annotation-canvas-drawing').querySelector('svg'),
).not.toBeNull(),
)
return { user, view }
}
const addPoint = async (user: ReturnType<typeof userEvent.setup>) => {
await waitFor(() =>
expect(
screen.getByRole('button', { name: 'Ajouter un point' }),
).toBeEnabled(),
)
await user.click(screen.getByRole('button', { name: 'Ajouter un point' }))
}
describe('the shown view disappears (undo)', () => {
async function onDetailView() {
const base = await mountDrawing()
act(
() => void store.getState().commit({ op: 'insert', element: detailView }),
)
await base.user.click(await screen.findByRole('button', { name: 'Tête' }))
return base
}
it('a pending point on it: back to the main view, the creation cleared', async () => {
const { user } = await onDetailView()
await addPoint(user)
expect(await screen.findByTestId('annotation-creation')).toBeInTheDocument()
act(() => void store.getState().undoStep())
await waitFor(() =>
expect(screen.queryByTestId('annotation-creation')).toBeNull(),
)
expect(screen.queryByRole('button', { name: 'Tête' })).toBeNull()
expect(screen.getByTestId('annotation-overview')).toBeInTheDocument()
expect(store.getState().previewState!.document.annotations).toHaveLength(0)
})
it('a tracing on it: the tracing is cleared too', async () => {
const { user } = await onDetailView()
await waitFor(() =>
expect(screen.getByRole('button', { name: 'Zone' })).toBeEnabled(),
)
await user.click(screen.getByRole('button', { name: 'Zone' }))
fireEvent.click(screen.getByTestId('annotation-canvas'), {
clientX: 20,
clientY: 30,
})
expect(screen.getByTestId('tracing-bar')).toBeInTheDocument()
act(() => void store.getState().undoStep())
await waitFor(() => expect(screen.queryByTestId('tracing-bar')).toBeNull())
})
it('dispatches nothing while the shown view still exists', async () => {
const { user } = await onDetailView()
await addPoint(user)
const panel = await screen.findByTestId('annotation-creation')
const element = point('anno-x', 30, 40, 2, 'view-det')
act(() => void store.getState().commit({ op: 'insert', element }))
expect(screen.getByTestId('annotation-creation')).toBe(panel)
})
})
describe('« Aller à » an annotation while something is in progress', () => {
const key = { kind: 'annotation', id: 'anno-a' } as const
const request = { target: targetOfKey(key), serial: 7 }
async function withProgress(
start: (user: ReturnType<typeof userEvent.setup>) => Promise<void>,
) {
const text = insert(drawnText(), point('anno-a', 50, 50, 5))
const { user, view } = await mountDrawing(text)
await start(user)
view.rerender(<Drawing focus={request} />)
return { consumed, announce }
}
it('a pending creation is kept: its panel takes the focus, the live region says why', async () => {
const { consumed, announce } = await withProgress(addPoint)
await waitFor(() => expect(consumed).toHaveBeenCalledWith(7, 'kept'))
expect(screen.getByTestId('annotation-creation')).toBeInTheDocument()
expect(document.activeElement).toHaveAttribute('data-creation-heading')
expect(announce).toHaveBeenCalledWith(
expect.stringContaining('création est en cours'),
)
expect(screen.queryByTestId('annotation-properties')).toBeNull()
})
it('an open zone tracing is kept: the bar takes the focus', async () => {
const { consumed, announce } = await withProgress(async (user) => {
await waitFor(() =>
expect(screen.getByRole('button', { name: 'Zone' })).toBeEnabled(),
)
await user.click(screen.getByRole('button', { name: 'Zone' }))
fireEvent.click(screen.getByTestId('annotation-canvas'), {
clientX: 20,
clientY: 20,
})
})
await waitFor(() => expect(consumed).toHaveBeenCalledWith(7, 'kept'))
expect(document.activeElement).toBe(screen.getByTestId('tracing-bar'))
expect(announce).toHaveBeenCalledWith(
expect.stringContaining('tracé est en cours'),
)
})
it('with nothing in progress the annotation is selected and its heading focused', async () => {
const { consumed } = await withProgress(async () => undefined)
await waitFor(() => expect(consumed).toHaveBeenCalledWith(7, 'found'))
await waitFor(() =>
expect(document.activeElement).toHaveAttribute('data-properties-heading'),
)
})
})
@@ -4,6 +4,7 @@ import { cleanup, render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
import DeleteDialog from '@/components/editor/DeleteDialog'
import CategoriesSection from '@/components/editor/general/CategoriesSection'
import GeneralTab from '@/components/editor/tabs/GeneralTab'
import { useLocaleStore } from '@/state/localeStore'
import { edit, insert } from '../helpers/editorFixtures'
@@ -24,7 +25,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
@@ -102,11 +103,17 @@ describe('Général: texts and attribution', () => {
})
})
describe('Général: annotation categories', () => {
describe('Annotations, section Catégories', () => {
it('Général no longer holds the categories editor', async () => {
await openReady()
render(<GeneralTab {...props} />)
expect(screen.queryByText("Catégories d'annotation")).toBeNull()
})
it('renames, recolours and adds a category', async () => {
await openReady()
const user = userEvent.setup()
render(<GeneralTab {...props} />)
render(<CategoriesSection doc={doc()} readOnly={false} />)
const row = screen.getByLabelText('Nom de la catégorie (FR)', {
selector: '#category-cat-a-name-fr',
})
@@ -140,7 +147,7 @@ describe('Général: annotation categories', () => {
it('a new category needs both names', async () => {
await openReady()
const user = userEvent.setup()
render(<GeneralTab {...props} />)
render(<CategoriesSection doc={doc()} readOnly={false} />)
await user.click(
screen.getByRole('button', { name: 'Ajouter la catégorie' }),
)
@@ -151,7 +158,7 @@ describe('Général: annotation categories', () => {
it('a used category cannot be deleted: the dialog lists the dependents', async () => {
await openReady()
const user = userEvent.setup()
render(<GeneralTab {...props} />)
render(<CategoriesSection doc={doc()} readOnly={false} />)
await user.click(screen.getByRole('button', { name: 'Supprimer' }))
const dialog = await screen.findByRole('dialog')
expect(within(dialog).getByText(/utilise cette catégorie/)).toBeTruthy()
@@ -171,7 +178,7 @@ describe('Général: annotation categories', () => {
})
await openReady({ text })
const user = userEvent.setup()
render(<GeneralTab {...props} />)
render(<CategoriesSection doc={doc()} readOnly={false} />)
const buttons = screen.getAllByRole('button', { name: 'Supprimer' })
await user.click(buttons[1])
const dialog = await screen.findByRole('dialog')
+14 -12
View File
@@ -3,8 +3,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { cleanup, render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
import ReferencesTab from '@/components/editor/tabs/ReferencesTab'
import VertebraeTab from '@/components/editor/tabs/VertebraeTab'
import ReferencesPanel from '@/components/editor/references/ReferencesPanel'
import RegionsSection from '@/components/editor/annotations/sections/RegionsSection'
import { useLocaleStore } from '@/state/localeStore'
import { edit, insert, point } from '../helpers/editorFixtures'
import {
@@ -24,7 +24,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
@@ -44,7 +44,7 @@ describe('Références', () => {
it('adds a reference only with a type and a citation', async () => {
await openReady()
const user = userEvent.setup()
render(<ReferencesTab {...props} />)
render(<ReferencesPanel {...props} open onClose={vi.fn()} />)
await user.click(
screen.getByRole('button', { name: 'Ajouter la référence' }),
)
@@ -72,7 +72,7 @@ describe('Références', () => {
)
await openReady({ text })
const user = userEvent.setup()
render(<ReferencesTab {...props} />)
render(<ReferencesPanel {...props} open onClose={vi.fn()} />)
const url = screen.getByLabelText('Adresse web (URL)', {
selector: '#reference-ref-a-url',
})
@@ -111,7 +111,7 @@ describe('Références', () => {
})
await openReady({ text })
const user = userEvent.setup()
render(<ReferencesTab {...props} />)
render(<ReferencesPanel {...props} open onClose={vi.fn()} />)
await user.click(screen.getAllByRole('button', { name: 'Supprimer' })[0])
const refused = await screen.findByRole('dialog')
expect(within(refused).getByText(/cite cette référence/)).toBeTruthy()
@@ -127,10 +127,12 @@ describe('Références', () => {
it('read-only shows the citations as text', async () => {
await openReady({ text: insert(baseText(), reference('ref-a', 'Alpha')) })
render(<ReferencesTab {...props} readOnly />)
render(<ReferencesPanel {...props} open onClose={vi.fn()} readOnly />)
expect(screen.getByText('Alpha')).toBeTruthy()
expect(screen.queryByRole('textbox')).toBeNull()
expect(screen.queryByRole('button')).toBeNull()
expect(
screen.getAllByRole('button').map((b) => b.getAttribute('aria-label')),
).toEqual(['Fermer les références'])
})
})
@@ -149,7 +151,7 @@ describe('Vertèbres', () => {
it('adds a region with a typed code; a bad count or half range never reaches the core', async () => {
await openReady()
const user = userEvent.setup()
render(<VertebraeTab {...props} />)
render(<RegionsSection {...props} />)
await user.type(screen.getByLabelText('Code'), 'C')
await user.type(screen.getByLabelText('Nom (FR)'), 'Cervicales')
await user.type(screen.getByLabelText('Nom (EN)'), 'Cervical')
@@ -178,7 +180,7 @@ describe('Vertèbres', () => {
const text = insert(insert(baseText(), region('C', 7)), region('T', 18))
await openReady({ text })
const user = userEvent.setup()
render(<VertebraeTab {...props} />)
render(<RegionsSection {...props} />)
const count = screen.getByLabelText('Nombre de vertèbres', {
selector: '#region-T-count',
})
@@ -238,7 +240,7 @@ describe('Vertèbres', () => {
})
await openReady({ text })
const user = userEvent.setup()
render(<VertebraeTab {...props} />)
render(<RegionsSection {...props} />)
await user.click(screen.getByRole('button', { name: 'Supprimer' }))
const dialog = await screen.findByRole('dialog')
expect(
@@ -249,7 +251,7 @@ describe('Vertèbres', () => {
it('read-only has no control', async () => {
await openReady({ text: insert(baseText(), region('C', 7)) })
render(<VertebraeTab {...props} readOnly />)
render(<RegionsSection {...props} readOnly />)
expect(screen.queryByRole('textbox')).toBeNull()
expect(screen.queryByRole('button')).toBeNull()
})
+14 -14
View File
@@ -7,7 +7,7 @@ import type {
AnatomicalSheetDocument,
NewElement,
} from '@faunosteo/core-wasm/types'
import ViewsTab from '@/components/editor/tabs/ViewsTab'
import ViewsSection from '@/components/editor/annotations/sections/ViewsSection'
import { useLocaleStore } from '@/state/localeStore'
import { ASSET, emptyText, insert, point } from '../helpers/editorFixtures'
import {
@@ -29,7 +29,7 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const props = { readOnly: false, onSelectTab: vi.fn(), reloadSheet: vi.fn() }
const props = { readOnly: false, navigate: vi.fn(), reloadSheet: vi.fn() }
const doc = (): AnatomicalSheetDocument =>
JSON.parse(store.getState().documentText)
const detail = (
@@ -56,7 +56,7 @@ afterEach(() => {
async function openCrop(text: string) {
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(
screen.getByRole('button', { name: 'Modifier le recadrage' }),
)
@@ -77,7 +77,7 @@ const cropField = (name: string) =>
describe('Vues et illustrations: drawing states', () => {
it('a valid main drawing shows its state and no hint', async () => {
await openReady()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText('Illustration valide')).toBeTruthy()
expect(
screen.queryByText(/Utilisez « Choisir une illustration »/),
@@ -86,7 +86,7 @@ describe('Vues et illustrations: drawing states', () => {
it('a main view without drawing shows the hint pointing at the button', async () => {
await openReady({ text: emptyText() })
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText('Aucune illustration')).toBeTruthy()
expect(
screen.getByText(/Utilisez « Choisir une illustration »/),
@@ -104,7 +104,7 @@ describe('Vues et illustrations: drawing states', () => {
)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(screen.getByText(/Illustration introuvable/)).toBeTruthy()
expect(
screen.getByText(/Utilisez « Choisir une illustration »/),
@@ -124,7 +124,7 @@ describe('Vues et illustrations: drawing states', () => {
sb.downloadSheetDrawing.mockResolvedValue(bytes)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(
screen.getByText(
/Illustration refusée : elle n'est pas sous la forme enregistrée/,
@@ -143,7 +143,7 @@ describe('Vues et illustrations: drawing states', () => {
)
store.getState().open('ver-1', 'user-1', { canEdit: true })
await vi.waitFor(() => expect(store.getState().status).toBe('ready'))
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
expect(
screen.getByText(/ne correspond pas à son empreinte SHA-256 enregistrée/),
).toBeTruthy()
@@ -155,7 +155,7 @@ describe('Vues et illustrations: drawing states', () => {
;(own.value as { svg_asset_id: string | null }).svg_asset_id = ASSET
await openReady({ text: insert(baseText(), own) })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
const open = () =>
user.click(
screen.getByRole('button', {
@@ -182,7 +182,7 @@ describe('Vues et illustrations: drawing states', () => {
it('read-only shows states as text and no action', async () => {
await openReady({ text: insert(baseText(), detail()) })
render(<ViewsTab {...props} readOnly />)
render(<ViewsSection {...props} readOnly />)
expect(screen.getByText('Illustration valide')).toBeTruthy()
expect(screen.queryByRole('button')).toBeNull()
expect(screen.queryByRole('textbox')).toBeNull()
@@ -193,7 +193,7 @@ describe('Vues et illustrations: detail views', () => {
it('adds a detail view with names and a crop, in one insert', async () => {
await openReady()
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(screen.getByRole('button', { name: 'Ajouter la vue' }))
expect(screen.getByRole('alert')).toHaveTextContent('Renseignez les noms')
await user.type(document.getElementById('view-new-fr')!, 'Tête')
@@ -224,7 +224,7 @@ describe('Vues et illustrations: detail views', () => {
it('renames on blur and refuses a blank name locally', async () => {
await openReady({ text: insert(baseText(), detail()) })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
const name = document.getElementById('view-view-d-name-en')!
await user.clear(name)
await user.type(name, 'Lower leg')
@@ -243,7 +243,7 @@ describe('Vues et illustrations: detail views', () => {
)
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.click(screen.getByRole('button', { name: 'Supprimer' }))
const dialog = await screen.findByRole('dialog')
expect(within(dialog).getByText(/ne peut pas être supprimé/)).toBeTruthy()
@@ -359,7 +359,7 @@ describe('Vues et illustrations: crop group under the frame check', () => {
const text = insert(insert(baseText(), detail()), detail2())
await openReady({ text })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
render(<ViewsSection {...props} />)
await user.selectOptions(
document.getElementById('view-view-d-parent')!,
'view-e',
@@ -4,7 +4,12 @@ import { act, cleanup, render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { SheetFailure } from '@faunosteo/supabase'
import VerificationTab from '@/components/editor/tabs/VerificationTab'
import { ISSUE_CODES, issueMessageKey } from '@/editor/verification'
import {
ISSUE_CODES,
issueMessageKey,
issueTarget,
placeKey,
} from '@/editor/verification'
import { getDict } from '@/i18n'
import { useLocaleStore } from '@/state/localeStore'
import { insert, point } from '../helpers/editorFixtures'
@@ -27,10 +32,9 @@ vi.mock('@faunosteo/supabase', async (orig) => ({
submitSheetReview: vi.fn(),
}))
const onSelectTab = vi.fn()
const navigate = vi.fn()
const reloadSheet = vi.fn()
const onGoTo = vi.fn()
const props = { readOnly: false, onSelectTab, onGoTo, reloadSheet }
const props = { readOnly: false, navigate, reloadSheet }
const SUBMIT = 'Soumettre à la revue'
/** An annotation without geometry: a blocking error of the core. */
@@ -48,8 +52,7 @@ beforeEach(() => useLocaleStore.setState({ locale: 'fr' }))
afterEach(() => {
cleanup()
resetStore()
onSelectTab.mockReset()
onGoTo.mockReset()
navigate.mockReset()
reloadSheet.mockReset()
})
@@ -81,10 +84,15 @@ describe('Vérification panel', () => {
await user.click(
screen.getAllByRole('button', { name: 'Aller à Sans tracé' })[0],
)
expect(onGoTo).toHaveBeenCalledWith('annotations', {
kind: 'annotation',
id: 'anno-bare',
})
expect(navigate).toHaveBeenCalledWith(
{
place: 'tab',
tab: 'annotations',
section: 'drawing',
key: { kind: 'annotation', id: 'anno-bare' },
},
expect.any(HTMLElement),
)
expect(screen.queryByText('Aucun problème détecté')).toBeNull()
})
@@ -204,6 +212,62 @@ describe('Submission', () => {
})
})
describe('issueTarget', () => {
const at = (path: string) => issueTarget(doc(), path, 'fr')?.target
const doc = () => JSON.parse(store.getState().documentText)
it('each issue root names its place and the element it resolves to', async () => {
await openReady({ text: textWithError() })
expect(at('views[0].frame')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'views',
key: { kind: 'view', id: 'view-main' },
})
expect(at('categories[0].name')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'categories',
key: { kind: 'category', id: 'cat-a' },
})
expect(at('vertebral_config.regions[0].count')).toMatchObject({
place: 'tab',
tab: 'annotations',
section: 'regions',
})
expect(at('references[0].citation')).toMatchObject({
place: 'references',
citedBy: null,
})
expect(at('finding_zones[0].name')).toMatchObject({
place: 'tab',
tab: 'findings',
})
expect(at('annotations[0].geometry')).toMatchObject({
tab: 'annotations',
section: 'drawing',
})
})
it('a path whose element is gone names the place alone, and the label names it', async () => {
await openReady({ text: textWithError() })
const gone = at('views[9].frame')
expect(gone).toEqual({
place: 'tab',
tab: 'annotations',
section: 'views',
key: null,
})
expect(placeKey(gone!)).toBe('editor.place.views')
expect(placeKey(at('references[9].citation')!)).toBe(
'editor.place.references',
)
expect(placeKey(at('annotations[9].geometry')!)).toBe(
'editor.tab.annotations',
)
})
})
describe('Issue messages', () => {
it('has an FR and an EN message for every known code', () => {
for (const code of ISSUE_CODES) {