fix(editor): overview rows ask first, no empty save, board 31 icons
U2 Task 6 review by self: - The overview stays shown during a selection (A3): its rows and view rows now go through the drawing guard, so a started move or redraw asks before a click there drops it (R-12). Was a regression: the column was unreachable while selected before Task 6. - The edit form compares and merges trimmed names and colour: a space typed alone is no change and writes no `update`. - A layer opened with no opener (reload, Forward) returns the focus to its row on close. - Board 31 A: icons on « Modifier », « Modifier la forme » (the shape's glyph), « Marquer comme relu »; « Supprimer » as red text with its trash icon. - Tests: overview row and view row ask during a started move; a row asks during a started redraw; whitespace-only save; unnamed link read rows; focus back to the row with no opener. Dead helpers removed (tests/helpers openProperties, e2e propertiesDialog). Mapping: the point-edit « Enter on the selected row … asks first » test (which replaced « Toutes les annotations asks first ») keeps its place; the overview-row path it did not cover now has its own test.
This commit is contained in:
1 parent
cd794f3c39
commit
ebcf2723a0
10 files changed
+145
-25
No files matched your search
@@ -24,17 +24,3 @@ export function LayeredTab(
|
||||
</AnnounceContext>
|
||||
)
|
||||
}
|
||||
|
||||
/** « Propriétés » in the strip, then the dialog it opened. */
|
||||
export async function openProperties(
|
||||
user: { click: (element: Element) => Promise<void> },
|
||||
within: (element: HTMLElement) => {
|
||||
getByRole: (role: string, o: object) => HTMLElement
|
||||
},
|
||||
): Promise<HTMLElement> {
|
||||
const strip = document.querySelector<HTMLElement>(
|
||||
'[data-testid="edit-strip"]',
|
||||
)!
|
||||
await user.click(within(strip).getByRole('button', { name: 'Propriétés' }))
|
||||
return document.querySelector<HTMLElement>('dialog[open]')!
|
||||
}
|
||||
@@ -219,6 +219,47 @@ describe('the read mode (board 31 A, B)', () => {
|
||||
expect(within(dialog()!).getByText('#aa0000')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('an unnamed link: its opened view, « Vue ouverte », no findings zone', async () => {
|
||||
const detail = insert(drawnText(), {
|
||||
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: 10, width: 80, height: 80 },
|
||||
parent_view_id: 'view-main',
|
||||
},
|
||||
})
|
||||
const link = {
|
||||
id: 'link-a',
|
||||
view_id: 'view-main',
|
||||
category_id: 'cat-a',
|
||||
laterality: 'unpaired',
|
||||
geometry: { type: 'circle', cx: 90, cy: 90, r: 3 },
|
||||
review_status: 'to_confirm',
|
||||
color: null,
|
||||
kind: 'detail_trigger',
|
||||
name: null,
|
||||
opens_view_id: 'view-det',
|
||||
} as Annotation
|
||||
await mount(insert(detail, { kind: 'annotation', value: link }))
|
||||
await selectRow('link-a')
|
||||
const opened = await openProperties()
|
||||
expect(rows()).toEqual([
|
||||
'Nom (FR)',
|
||||
'Nom (EN)',
|
||||
'Catégorie',
|
||||
'Latéralité',
|
||||
'Vue ouverte',
|
||||
'Vue',
|
||||
])
|
||||
expect(within(opened).getByTestId('annotation-read')).toHaveTextContent(
|
||||
'Accès',
|
||||
)
|
||||
expect(within(opened).getAllByText('Tête').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('« Marquer comme relu » is one change and one undo (A10)', async () => {
|
||||
await mount(insert(drawnText(), point('a', 50, 50, 5)))
|
||||
await selectRow('a')
|
||||
@@ -334,6 +375,22 @@ describe('the edit form (board 31 C, R-3)', () => {
|
||||
expect(store.getState().documentText).toBe(before)
|
||||
})
|
||||
|
||||
it('a space typed and nothing else: no change, no history entry', async () => {
|
||||
await mount(insert(drawnText(), point('a', 50, 50, 5)))
|
||||
await selectRow('a')
|
||||
await startEdit()
|
||||
const user = userEvent.setup()
|
||||
const before = depth()
|
||||
await user.type(field('Nom (FR)'), ' ')
|
||||
await user.click(
|
||||
within(dialog()!).getByRole('button', { name: 'Enregistrer' }),
|
||||
)
|
||||
expect(depth()).toBe(before)
|
||||
expect(
|
||||
within(dialog()!).getByRole('button', { name: 'Modifier' }),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('« Annuler » with changes asks; « Abandonner » writes nothing', async () => {
|
||||
await mount(insert(drawnText(), point('a', 50, 50, 5)))
|
||||
await selectRow('a')
|
||||
@@ -483,6 +540,17 @@ describe('the layer (history)', () => {
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('a layer opened with no opener (a Forward, a reload) returns the focus to its row', async () => {
|
||||
await mount(insert(drawnText(), point('a', 50, 50, 5)))
|
||||
act(() => layered.nav!.openAnnotation('a'))
|
||||
const opened = await screen.findByRole('dialog')
|
||||
await userEvent
|
||||
.setup()
|
||||
.click(within(opened).getByRole('button', { name: 'Fermer' }))
|
||||
await waitFor(() => expect(dialog()).toBeNull())
|
||||
await waitFor(() => expect(document.activeElement).toBe(rowOf('a')))
|
||||
})
|
||||
|
||||
it('a deletion from the dialog closes it, unsaid as a vanish', async () => {
|
||||
await mount(insert(drawnText(), point('a', 50, 50, 5)))
|
||||
await selectRow('a')
|
||||
|
||||
@@ -505,6 +505,26 @@ describe('review fixes: no silent loss, no empty commit, no lost focus', () => {
|
||||
expect(screen.queryByTestId('annotation-creation')).toBeNull()
|
||||
})
|
||||
|
||||
it('another row or a view row of the overview asks first (A3: the column stays shown)', async () => {
|
||||
await started()
|
||||
const list = screen.getByRole('list', { name: 'Annotations de la vue' })
|
||||
const rows = within(list).getAllByRole('button')
|
||||
const other = rows.find(
|
||||
(row) => row.getAttribute('aria-current') !== 'true',
|
||||
)!
|
||||
fireEvent.click(other)
|
||||
expect(question()).toBe('move')
|
||||
expect(useAnnotationWork.getState().mode?.started).toBe(true)
|
||||
expect(within(list).getByRole('button', { current: true })).not.toBe(other)
|
||||
act(() => useAnnotationWork.setState({ question: null }))
|
||||
const views = screen
|
||||
.getByRole('heading', { name: 'Vues' })
|
||||
.closest('section')!
|
||||
fireEvent.click(within(views).getAllByRole('button')[0]!)
|
||||
expect(question()).toBe('move')
|
||||
expect(screen.getByTestId('move-mode-bar')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('an unstarted mode ends at once on a tool change', async () => {
|
||||
await mount(two())
|
||||
await select()
|
||||
|
||||
@@ -575,6 +575,17 @@ describe('redraw (R-12, board 06 C)', () => {
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('a row of the overview asks first once a vertex is placed (A3, R-12)', async () => {
|
||||
await redrawing()
|
||||
pressAt(canvas(), 30, 30)
|
||||
const list = screen.getByRole('list', { name: 'Annotations de la vue' })
|
||||
fireEvent.click(within(list).getAllByRole('button')[0]!)
|
||||
expect(useAnnotationWork.getState().question?.work).toBe('redraw')
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Fermer le tracé' }),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('a tool asks first once a vertex is placed; « Abandonner » ends the trace', async () => {
|
||||
await redrawing()
|
||||
pressAt(canvas(), 30, 30)
|
||||
|
||||
Reference in new issue
Block a user