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:
1 parent
95b1b7e461
commit
bc2dba7c14
56 files changed
+2419
-699
No files matched your search
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user