fix(editor): name vertex handles after their zone, in a named group
Criterion 18: « Sommet {n} de {nom} », « Ajouter un sommet après le sommet
{n} de {nom} », « Retirer le sommet {n} de {nom} » (EN « Vertex {n} of
{name} » …), {nom} the zone's display name in the current locale; the
handle group is a role="group" named « Sommets de {nom} ».
Tests: no assertion removed; every unit and e2e locator that read the old
names now reads the same handle with the zone name appended (fixtures: N,
Vertèbres thoraciques, Zone dessinée, Zone clavier). New unit tests in
editor-zone-edit cover the FR names, the group and the EN locale.
This commit is contained in:
1 parent
fab641c278
commit
b6aa2819ea
15 files changed
+165
-67
No files matched your search
@@ -295,11 +295,15 @@ test.describe('editor annotations (A3)', () => {
|
||||
|
||||
// « + » after vertex 1 by Enter: four vertices; Delete on the chosen one: three again.
|
||||
await page
|
||||
.getByRole('button', { name: 'Ajouter un sommet après le sommet 1' })
|
||||
.getByRole('button', {
|
||||
name: 'Ajouter un sommet après le sommet 1 de Zone clavier',
|
||||
})
|
||||
.focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await expect.poll(async () => (await shownPoints(page)).length).toBe(4)
|
||||
await page.getByRole('button', { name: 'Sommet 2', exact: true }).focus()
|
||||
await page
|
||||
.getByRole('button', { name: 'Sommet 2 de Zone clavier', exact: true })
|
||||
.focus()
|
||||
await page.keyboard.press('Delete')
|
||||
await expect.poll(async () => (await shownPoints(page)).length).toBe(3)
|
||||
// Escape unchooses the vertex (board 32 row 5): the strip offers the zone's move.
|
||||
|
||||
@@ -222,7 +222,10 @@ async function modifyAnnotations(page: Page) {
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', String(point))
|
||||
await pickAnnotation(page, dict, /Zone dessinée/)
|
||||
const [[start]] = await shownPoints(page)
|
||||
const first = page.getByRole('button', { name: 'Sommet 1', exact: true })
|
||||
const first = page.getByRole('button', {
|
||||
name: 'Sommet 1 de Zone dessinée',
|
||||
exact: true,
|
||||
})
|
||||
const vertex = await stepRight(page, first, start, MODIFIED.vertex)
|
||||
await expect.poll(async () => (await shownPoints(page))[0][0]).toBe(vertex)
|
||||
await pickAnnotation(page, dict, /Accès essai/)
|
||||
|
||||
@@ -104,7 +104,9 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
// The row sits low in the equine list: the click left the drawing out of view.
|
||||
await scrollToTop(page)
|
||||
await expect(selectionTag(page)).toContainText('Vertèbres thoraciques')
|
||||
await expect(handle(page, 'Sommet 9')).toBeAttached()
|
||||
await expect(
|
||||
handle(page, 'Sommet 9 de Vertèbres thoraciques'),
|
||||
).toBeAttached()
|
||||
// R-18: at fit zoom some segments are too short for their « + ».
|
||||
await expect(page.getByTestId('edit-strip-notice')).toContainText(
|
||||
dict['editor.annotations.strip.zoom_hint'],
|
||||
@@ -125,7 +127,10 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
|
||||
// « + » on the segment from vertex 2: a vertex added and chosen, then undone.
|
||||
await expectNoShift(page, async () => {
|
||||
await pressHandle(page, 'Ajouter un sommet après le sommet 2')
|
||||
await pressHandle(
|
||||
page,
|
||||
'Ajouter un sommet après le sommet 2 de Vertèbres thoraciques',
|
||||
)
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.vertex_added'],
|
||||
)
|
||||
@@ -138,13 +143,13 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
|
||||
// « − » on the chosen vertex 3, then undone.
|
||||
await expectNoShift(page, async () => {
|
||||
await pressHandle(page, 'Sommet 3')
|
||||
await pressHandle(page, 'Sommet 3 de Vertèbres thoraciques')
|
||||
await expect(page.getByTestId('edit-strip-detail')).toContainText(
|
||||
'sommet 3 choisi',
|
||||
)
|
||||
})
|
||||
await expectNoShift(page, async () => {
|
||||
await pressHandle(page, 'Retirer le sommet 3')
|
||||
await pressHandle(page, 'Retirer le sommet 3 de Vertèbres thoraciques')
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.vertex_removed'],
|
||||
)
|
||||
@@ -172,7 +177,7 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
await pickAnnotation(page, dict, THORACIC)
|
||||
const [, second] = await shownPoints(page)
|
||||
await handle(page, 'Sommet 2').focus()
|
||||
await handle(page, 'Sommet 2 de Vertèbres thoraciques').focus()
|
||||
await page.keyboard.press('ArrowDown')
|
||||
// Not under expectNoShift: the button returns the focus to the list row, which
|
||||
// scrolls it into view by design.
|
||||
|
||||
@@ -125,14 +125,19 @@ async function dragVertex(page: Page) {
|
||||
async function chooseVertex3(page: Page) {
|
||||
const detail = page.getByTestId('edit-strip-detail')
|
||||
if ((await detail.textContent())?.includes('sommet 3 choisi')) return
|
||||
await pressHandle(page, 'Sommet 3')
|
||||
await pressHandle(page, 'Sommet 3 de Vertèbres thoraciques')
|
||||
await expect(detail).toContainText('sommet 3 choisi')
|
||||
}
|
||||
|
||||
const GESTURES: Record<Gesture, (page: Page) => Promise<void>> = {
|
||||
drag: dragVertex,
|
||||
insert: (page) => pressHandle(page, 'Ajouter un sommet après le sommet 2'),
|
||||
remove: (page) => pressHandle(page, 'Retirer le sommet 3'),
|
||||
insert: (page) =>
|
||||
pressHandle(
|
||||
page,
|
||||
'Ajouter un sommet après le sommet 2 de Vertèbres thoraciques',
|
||||
),
|
||||
remove: (page) =>
|
||||
pressHandle(page, 'Retirer le sommet 3 de Vertèbres thoraciques'),
|
||||
}
|
||||
|
||||
/** Back to the stored zone with an empty undo stack, checked. */
|
||||
|
||||
@@ -118,7 +118,10 @@ async function follow(from: { x: number; y: number }, moveTo: Mover) {
|
||||
|
||||
async function vertexCentre(page: Page) {
|
||||
const box = (await page
|
||||
.getByRole('button', { name: 'Sommet 1', exact: true })
|
||||
.getByRole('button', {
|
||||
name: 'Sommet 1 de Vertèbres thoraciques',
|
||||
exact: true,
|
||||
})
|
||||
.locator('[data-handle]')
|
||||
.boundingBox())!
|
||||
return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
|
||||
|
||||
@@ -327,7 +327,11 @@ function CanvasStage({
|
||||
// A12: during a creation nothing else is selected or opened from the drawing.
|
||||
const free = creation === null
|
||||
const points = shown ? handledPoints(work.target?.geometry ?? null) : null
|
||||
const zone = points && { annotationId: work.target!.id, points }
|
||||
const zone = points && {
|
||||
annotationId: work.target!.id,
|
||||
name: annotationName(work.target!, doc.views, locale),
|
||||
points,
|
||||
}
|
||||
const view = doc.views.find((v) => v.id === scene.viewId)
|
||||
const blocked = !model.measured || doc.categories.length === 0
|
||||
if (!view) return null
|
||||
|
||||
@@ -9,6 +9,8 @@ import { useT } from '@/i18n/useT'
|
||||
/** The selected polygon whose vertex, « + » and « − » handles the layer draws. */
|
||||
export interface ZoneHandle {
|
||||
annotationId: string
|
||||
/** Its display name in the current locale: « Sommet 3 de {nom} ». */
|
||||
name: string
|
||||
points: Point[]
|
||||
}
|
||||
|
||||
@@ -303,9 +305,20 @@ export default function ZoneHandles({
|
||||
const group = useFocusFollowsChoice(chosen)
|
||||
const inserts = shownInserts(points, scale)
|
||||
const named = (key: string, n: number) =>
|
||||
t(`editor.annotations.handle.${key}`).replace('{n}', String(n + 1))
|
||||
t(`editor.annotations.handle.${key}`)
|
||||
.replace('{n}', String(n + 1))
|
||||
.replace('{name}', () => zone.name)
|
||||
const groupName = t('editor.annotations.handle.group').replace(
|
||||
'{name}',
|
||||
() => zone.name,
|
||||
)
|
||||
return (
|
||||
<g ref={group} data-testid="zone-handles">
|
||||
<g
|
||||
ref={group}
|
||||
role="group"
|
||||
aria-label={groupName}
|
||||
data-testid="zone-handles"
|
||||
>
|
||||
{points.map((p, i) =>
|
||||
inserts[i] ? (
|
||||
<Insert
|
||||
|
||||
@@ -1837,9 +1837,10 @@ export const en: Dict = {
|
||||
'editor.annotations.move.confirm': 'Confirm position',
|
||||
'editor.annotations.move.cancel': 'Cancel',
|
||||
'editor.annotations.handle.shape': '{kind} {name}',
|
||||
'editor.annotations.handle.vertex': 'Vertex {n}',
|
||||
'editor.annotations.handle.insert': 'Add a vertex after vertex {n}',
|
||||
'editor.annotations.handle.remove': 'Remove vertex {n}',
|
||||
'editor.annotations.handle.group': 'Vertices of {name}',
|
||||
'editor.annotations.handle.vertex': 'Vertex {n} of {name}',
|
||||
'editor.annotations.handle.insert': 'Add a vertex after vertex {n} of {name}',
|
||||
'editor.annotations.handle.remove': 'Remove vertex {n} of {name}',
|
||||
'editor.annotations.strip.vertex_chosen': '{detail} · vertex {n} chosen',
|
||||
'editor.annotations.strip.too_many_one':
|
||||
'{kind} · {count} vertex, too many for handles',
|
||||
|
||||
@@ -1906,9 +1906,11 @@ export const fr: Dict = {
|
||||
'editor.annotations.move.confirm': 'Valider la position',
|
||||
'editor.annotations.move.cancel': 'Annuler',
|
||||
'editor.annotations.handle.shape': '{kind} {name}',
|
||||
'editor.annotations.handle.vertex': 'Sommet {n}',
|
||||
'editor.annotations.handle.insert': 'Ajouter un sommet après le sommet {n}',
|
||||
'editor.annotations.handle.remove': 'Retirer le sommet {n}',
|
||||
'editor.annotations.handle.group': 'Sommets de {name}',
|
||||
'editor.annotations.handle.vertex': 'Sommet {n} de {name}',
|
||||
'editor.annotations.handle.insert':
|
||||
'Ajouter un sommet après le sommet {n} de {name}',
|
||||
'editor.annotations.handle.remove': 'Retirer le sommet {n} de {name}',
|
||||
'editor.annotations.strip.vertex_chosen': '{detail} · sommet {n} choisi',
|
||||
'editor.annotations.strip.too_many_one':
|
||||
'{kind} · {count} sommet, trop pour les poignées',
|
||||
|
||||
@@ -708,7 +708,7 @@ describe('polygons and paths', () => {
|
||||
it('« + » adds a vertex on the drawing and « − » removes it', async () => {
|
||||
await mount({ text: zoneText({ type: 'polygon', points: triangle }) })
|
||||
await selectFromList()
|
||||
pressAt(handleHit('Ajouter un sommet après le sommet 1'), 50, 20)
|
||||
pressAt(handleHit('Ajouter un sommet après le sommet 1 de N'), 50, 20)
|
||||
expect(geometryOf('zone-a')).toMatchObject({
|
||||
points: [
|
||||
[20, 20],
|
||||
@@ -717,16 +717,16 @@ describe('polygons and paths', () => {
|
||||
[50, 80],
|
||||
],
|
||||
})
|
||||
pressAt(handleHit('Retirer le sommet 2'), 50, 10)
|
||||
pressAt(handleHit('Retirer le sommet 2 de N'), 50, 10)
|
||||
expect(geometryOf('zone-a')).toMatchObject({ points: triangle })
|
||||
})
|
||||
|
||||
it('never removes a vertex below three: « − » is greyed', async () => {
|
||||
await mount({ text: zoneText({ type: 'polygon', points: triangle }) })
|
||||
await selectFromList()
|
||||
pressAt(handleHit('Sommet 1'), 20, 20)
|
||||
pressAt(handleHit('Sommet 1 de N'), 20, 20)
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Retirer le sommet 1' }),
|
||||
screen.getByRole('button', { name: 'Retirer le sommet 1 de N' }),
|
||||
).toHaveAttribute('aria-disabled', 'true')
|
||||
})
|
||||
|
||||
@@ -909,7 +909,7 @@ describe('refusals through the tab (H8)', () => {
|
||||
await selectFromList()
|
||||
const before = store.getState().documentText
|
||||
const vertex = screen
|
||||
.getByRole('button', { name: 'Sommet 1' })
|
||||
.getByRole('button', { name: 'Sommet 1 de N' })
|
||||
.querySelector('[data-handle]')!
|
||||
mouseDrag(vertex, [20, 20], [500, 20])
|
||||
expect(store.getState().documentText).toBe(before)
|
||||
|
||||
@@ -161,7 +161,7 @@ describe('the two-finger hint (R-1)', () => {
|
||||
it('never replaces a message that shows', async () => {
|
||||
await mount()
|
||||
await select()
|
||||
drag(hitOf('Sommet 2'), [80, 20], [90, 10], 'mouse')
|
||||
drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10], 'mouse')
|
||||
expect(line()).toHaveTextContent('Sommet déplacé')
|
||||
drag(canvas(), [5, 5], [45, 5])
|
||||
expect(line()).toHaveTextContent('Sommet déplacé')
|
||||
@@ -209,7 +209,7 @@ describe('the loupe of a finger drag', () => {
|
||||
.querySelector('svg')!
|
||||
drawing.setAttribute('id', 'drawing-root')
|
||||
drawing.firstElementChild?.setAttribute('id', 'drawing-part')
|
||||
const vertex = hitOf('Sommet 2')
|
||||
const vertex = hitOf('Sommet 2 de N')
|
||||
fireEvent.pointerDown(vertex, finger(1, 80, 20))
|
||||
fireEvent.pointerMove(vertex, finger(1, 95, 35))
|
||||
expect(loupe()).not.toBeNull()
|
||||
@@ -222,7 +222,7 @@ describe('the loupe of a finger drag', () => {
|
||||
it('shows a picture of the drawing above the finger, then goes on the drop', async () => {
|
||||
await mount()
|
||||
await select()
|
||||
const vertex = hitOf('Sommet 2')
|
||||
const vertex = hitOf('Sommet 2 de N')
|
||||
fireEvent.pointerDown(vertex, finger(1, 80, 20))
|
||||
fireEvent.pointerMove(vertex, finger(1, 95, 35))
|
||||
const shown = loupe()!
|
||||
@@ -239,7 +239,7 @@ describe('the loupe of a finger drag', () => {
|
||||
it('goes when the drag is cancelled by a second finger', async () => {
|
||||
await mount()
|
||||
await select()
|
||||
const vertex = hitOf('Sommet 2')
|
||||
const vertex = hitOf('Sommet 2 de N')
|
||||
fireEvent.pointerDown(vertex, finger(1, 80, 20))
|
||||
fireEvent.pointerMove(vertex, finger(1, 95, 35))
|
||||
expect(loupe()).not.toBeNull()
|
||||
@@ -250,7 +250,7 @@ describe('the loupe of a finger drag', () => {
|
||||
it('a mouse drag shows none', async () => {
|
||||
await mount()
|
||||
await select()
|
||||
const vertex = hitOf('Sommet 2')
|
||||
const vertex = hitOf('Sommet 2 de N')
|
||||
fireEvent.pointerDown(vertex, finger(1, 80, 20, 'mouse'))
|
||||
fireEvent.pointerMove(vertex, finger(1, 95, 35, 'mouse'))
|
||||
expect(loupe()).toBeNull()
|
||||
|
||||
@@ -133,11 +133,13 @@ const mouse = {
|
||||
const hitOf = (name: string) =>
|
||||
screen.getByRole('button', { name }).querySelector('[data-handle]')!
|
||||
const vertex = (n: number) =>
|
||||
screen.getByRole('button', { name: `Sommet ${n}` })
|
||||
screen.getByRole('button', { name: `Sommet ${n} de N` })
|
||||
const plus = (n: number) =>
|
||||
screen.getByRole('button', { name: `Ajouter un sommet après le sommet ${n}` })
|
||||
screen.getByRole('button', {
|
||||
name: `Ajouter un sommet après le sommet ${n} de N`,
|
||||
})
|
||||
const minus = (n: number) =>
|
||||
screen.getByRole('button', { name: `Retirer le sommet ${n}` })
|
||||
screen.getByRole('button', { name: `Retirer le sommet ${n} de N` })
|
||||
const clickHandle = (name: string, at: [number, number] = [0, 0]) =>
|
||||
pressAt(hitOf(name), at[0], at[1])
|
||||
const marker = (id: string) =>
|
||||
@@ -166,7 +168,7 @@ describe('a vertex (R-9)', () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
expect(detail()).toHaveTextContent('Zone · 4 sommets')
|
||||
clickHandle('Sommet 2', [80, 20])
|
||||
clickHandle('Sommet 2 de N', [80, 20])
|
||||
expect(chosen()).toEqual({
|
||||
annotationId: 'z',
|
||||
vertex: 1,
|
||||
@@ -185,11 +187,11 @@ describe('a vertex (R-9)', () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
const before = depth()
|
||||
drag(hitOf('Sommet 2'), [80, 20], [90, 10])
|
||||
drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10])
|
||||
expect(pointsOf('z')![1]).toEqual([90, 10])
|
||||
expect(depth()).toBe(before + 1)
|
||||
expect(message()).toHaveTextContent('Sommet déplacé')
|
||||
drag(hitOf('Sommet 2'), [90, 10], [80, 80])
|
||||
drag(hitOf('Sommet 2 de N'), [90, 10], [80, 80])
|
||||
expect(pointsOf('z')![1]).toEqual([90, 10])
|
||||
expect(depth()).toBe(before + 1)
|
||||
})
|
||||
@@ -198,7 +200,7 @@ describe('a vertex (R-9)', () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
const before = depth()
|
||||
clickHandle('Ajouter un sommet après le sommet 1', [50, 20])
|
||||
clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20])
|
||||
expect(pointsOf('z')).toEqual([[20, 20], [50, 20], ...SQUARE.slice(1)])
|
||||
expect(depth()).toBe(before + 1)
|
||||
expect(chosen()).toMatchObject({ vertex: 1 })
|
||||
@@ -211,8 +213,8 @@ describe('a vertex (R-9)', () => {
|
||||
await mount(squareText())
|
||||
render(<UndoKeys />)
|
||||
await select()
|
||||
clickHandle('Ajouter un sommet après le sommet 1', [50, 20])
|
||||
const bubble = hitOf('Retirer le sommet 2')
|
||||
clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20])
|
||||
const bubble = hitOf('Retirer le sommet 2 de N')
|
||||
fireEvent.keyDown(document.body, { key: 'z', ctrlKey: true })
|
||||
expect(pointsOf('z')).toEqual(SQUARE)
|
||||
expect(chosen()).toBeNull()
|
||||
@@ -232,8 +234,8 @@ describe('a vertex (R-9)', () => {
|
||||
it('« − » removes the chosen vertex', async () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
clickHandle('Sommet 3', [80, 80])
|
||||
clickHandle('Retirer le sommet 3', [80, 70])
|
||||
clickHandle('Sommet 3 de N', [80, 80])
|
||||
clickHandle('Retirer le sommet 3 de N', [80, 70])
|
||||
expect(pointsOf('z')).toEqual([SQUARE[0], SQUARE[1], SQUARE[3]])
|
||||
expect(chosen()).toBeNull()
|
||||
expect(message()).toHaveTextContent('Sommet retiré')
|
||||
@@ -244,9 +246,9 @@ describe('a vertex (R-9)', () => {
|
||||
await mount(squareText(triangle))
|
||||
await select()
|
||||
const before = depth()
|
||||
clickHandle('Sommet 1', [20, 20])
|
||||
clickHandle('Sommet 1 de N', [20, 20])
|
||||
expect(minus(1)).toHaveAttribute('aria-disabled', 'true')
|
||||
clickHandle('Retirer le sommet 1', [20, 10])
|
||||
clickHandle('Retirer le sommet 1 de N', [20, 10])
|
||||
expect(pointsOf('z')).toEqual(triangle)
|
||||
expect(depth()).toBe(before)
|
||||
expect(message()).toHaveTextContent('Une zone garde au moins 3 sommets')
|
||||
@@ -279,14 +281,64 @@ describe('a vertex (R-9)', () => {
|
||||
.getAllByRole('button')
|
||||
.filter((b) => b.closest('[data-testid="handle-layer"]'))
|
||||
.map((b) => b.getAttribute('aria-label'))
|
||||
expect(order).toContain('Ajouter un sommet après le sommet 4')
|
||||
expect(order).toContain('Sommet 4')
|
||||
expect(order).toContain('Ajouter un sommet après le sommet 4 de N')
|
||||
expect(order).toContain('Sommet 4 de N')
|
||||
fireEvent.keyDown(plus(4), { key: 'Enter' })
|
||||
expect(pointsOf('z')).toHaveLength(5)
|
||||
expect(pointsOf('z')![4]).toEqual([20, 50])
|
||||
})
|
||||
})
|
||||
|
||||
describe('handle names carry the zone name (criterion 18)', () => {
|
||||
const named = (name: { fr: string; en: string }) =>
|
||||
insert(drawnText(), {
|
||||
kind: 'annotation',
|
||||
value: {
|
||||
...zone('z', { type: 'polygon', points: SQUARE }),
|
||||
name,
|
||||
} as Annotation,
|
||||
})
|
||||
|
||||
it('« Sommet {n} de {nom} », the « + » and « − » too, in a named group', async () => {
|
||||
await mount(named({ fr: 'Thoraciques', en: 'Thoracic' }))
|
||||
await select()
|
||||
expect(
|
||||
screen.getByRole('group', { name: 'Sommets de Thoraciques' }),
|
||||
).toBeInTheDocument()
|
||||
clickHandle('Sommet 2 de Thoraciques', [80, 20])
|
||||
expect(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ajouter un sommet après le sommet 1 de Thoraciques',
|
||||
}),
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('button', {
|
||||
name: 'Retirer le sommet 2 de Thoraciques',
|
||||
}),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('in English, the name of the current locale', async () => {
|
||||
useLocaleStore.setState({ locale: 'en' })
|
||||
await mount(named({ fr: 'Thoraciques', en: 'Thoracic' }))
|
||||
const list = await screen.findByRole('list', {
|
||||
name: 'Annotations of the view',
|
||||
})
|
||||
await userEvent.setup().click(within(list).getAllByRole('button')[0])
|
||||
expect(
|
||||
await screen.findByRole('group', { name: 'Vertices of Thoracic' }),
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Vertex 3 of Thoracic' }),
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('button', {
|
||||
name: 'Add a vertex after vertex 3 of Thoracic',
|
||||
}),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
|
||||
const twice = (el: Element, x: number, y: number) => {
|
||||
pressAt(el, x, y)
|
||||
@@ -297,7 +349,7 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
const before = depth()
|
||||
twice(hitOf('Ajouter un sommet après le sommet 1'), 50, 20)
|
||||
twice(hitOf('Ajouter un sommet après le sommet 1 de N'), 50, 20)
|
||||
expect(pointsOf('z')).toHaveLength(5)
|
||||
expect(depth()).toBe(before + 1)
|
||||
})
|
||||
@@ -306,7 +358,7 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
const spy = vi.spyOn(useAnnotationWork, 'setState')
|
||||
twice(hitOf('Sommet 2'), 80, 20)
|
||||
twice(hitOf('Sommet 2 de N'), 80, 20)
|
||||
const choices = spy.mock.calls.filter(
|
||||
([patch]) => typeof patch === 'object' && 'chosen' in patch,
|
||||
)
|
||||
@@ -318,9 +370,9 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
|
||||
it('on « − »: one removal, never a second', async () => {
|
||||
await mount(squareText([...SQUARE, [10, 50]]))
|
||||
await select()
|
||||
clickHandle('Sommet 2', [80, 20])
|
||||
clickHandle('Sommet 2 de N', [80, 20])
|
||||
const before = depth()
|
||||
pressAt(hitOf('Retirer le sommet 2'), 80, 10)
|
||||
pressAt(hitOf('Retirer le sommet 2 de N'), 80, 10)
|
||||
// The second click of the double click lands on what is there now, at the same place.
|
||||
pressAt(liveBubbleOrCanvas(), 80, 10)
|
||||
expect(pointsOf('z')).toHaveLength(4)
|
||||
@@ -364,7 +416,7 @@ describe('moving the zone (A11, R-12)', () => {
|
||||
it('« Déplacer le sommet » moves the chosen vertex only', async () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
clickHandle('Sommet 3', [80, 80])
|
||||
clickHandle('Sommet 3 de N', [80, 80])
|
||||
await userEvent
|
||||
.setup()
|
||||
.click(screen.getByRole('button', { name: 'Déplacer le sommet' }))
|
||||
@@ -444,10 +496,10 @@ describe('paths (UX_TESTS « Paths »)', () => {
|
||||
await mount(pathAndZone())
|
||||
const before = JSON.stringify(annotationOf('p').geometry)
|
||||
await select(1)
|
||||
clickHandle('Ajouter un sommet après le sommet 1', [72.5, 55])
|
||||
clickHandle('Sommet 2', [72.5, 55])
|
||||
clickHandle('Retirer le sommet 2', [72.5, 45])
|
||||
drag(hitOf('Sommet 1'), [55, 55], [60, 60])
|
||||
clickHandle('Ajouter un sommet après le sommet 1 de N', [72.5, 55])
|
||||
clickHandle('Sommet 2 de N', [72.5, 55])
|
||||
clickHandle('Retirer le sommet 2 de N', [72.5, 45])
|
||||
drag(hitOf('Sommet 1 de N'), [55, 55], [60, 60])
|
||||
drag(marker('z'), [80, 80], [85, 85])
|
||||
expect(depth()).toBe(4)
|
||||
expect(JSON.stringify(annotationOf('p').geometry)).toBe(before)
|
||||
@@ -710,7 +762,7 @@ describe('fix round 1: no lost series, no lost focus, no stale « − »', () =>
|
||||
it('M-2: a chosen vertex stamped on another text removes nothing', async () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
clickHandle('Sommet 2', [80, 20])
|
||||
clickHandle('Sommet 2 de N', [80, 20])
|
||||
const before = depth()
|
||||
act(() =>
|
||||
useAnnotationWork.setState({
|
||||
@@ -818,7 +870,7 @@ describe('the zoom hint for short segments (R-18, D2)', () => {
|
||||
await select()
|
||||
expect(
|
||||
screen.queryByRole('button', {
|
||||
name: 'Ajouter un sommet après le sommet 1',
|
||||
name: 'Ajouter un sommet après le sommet 1 de N',
|
||||
}),
|
||||
).toBeNull()
|
||||
expect(plus(2)).toBeInTheDocument()
|
||||
@@ -835,7 +887,7 @@ describe('the zoom hint for short segments (R-18, D2)', () => {
|
||||
it('a refusal takes its place while shown', async () => {
|
||||
await mount(squareText(SHORT))
|
||||
await select()
|
||||
drag(hitOf('Sommet 3'), [80, 20], [500, 20])
|
||||
drag(hitOf('Sommet 3 de N'), [80, 20], [500, 20])
|
||||
const notice = screen.getByTestId('edit-strip-notice')
|
||||
expect(notice).toHaveTextContent('Déplacement refusé')
|
||||
expect(notice).not.toHaveTextContent(zoomHint)
|
||||
@@ -1011,7 +1063,7 @@ describe('final review I-1: a redo or a handle key never drops pending work', ()
|
||||
it('in a started vertex move, Enter on « − », Insert and Delete change nothing', async () => {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
clickHandle('Sommet 3', [80, 80])
|
||||
clickHandle('Sommet 3 de N', [80, 80])
|
||||
await startedMove('Déplacer le sommet')
|
||||
const before = depth()
|
||||
fireEvent.keyDown(minus(3), { key: 'Enter' })
|
||||
@@ -1039,21 +1091,21 @@ describe('final review I-1 audit: a press on the drawing never drops a keyed ser
|
||||
|
||||
it('a press on « + »: the step is committed, then the insert', async () => {
|
||||
const before = await keyed()
|
||||
clickHandle('Ajouter un sommet après le sommet 1', [50.25, 20])
|
||||
clickHandle('Ajouter un sommet après le sommet 1 de N', [50.25, 20])
|
||||
expect(pointsOf('z')).toEqual([[20.5, 20], [50.25, 20], ...SQUARE.slice(1)])
|
||||
expect(depth()).toBe(before + 2)
|
||||
})
|
||||
|
||||
it('a press on « − »: the step is committed, then the removal', async () => {
|
||||
const before = await keyed([...SQUARE, [10, 50]])
|
||||
clickHandle('Retirer le sommet 1', [20.5, 20])
|
||||
clickHandle('Retirer le sommet 1 de N', [20.5, 20])
|
||||
expect(pointsOf('z')).toEqual([...SQUARE.slice(1), [10, 50]])
|
||||
expect(depth()).toBe(before + 2)
|
||||
})
|
||||
|
||||
it('a drag of another vertex carries the keyed step', async () => {
|
||||
await keyed()
|
||||
drag(hitOf('Sommet 2'), [80, 20], [90, 10])
|
||||
drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10])
|
||||
expect(pointsOf('z')).toEqual([[20.5, 20], [90, 10], ...SQUARE.slice(2)])
|
||||
})
|
||||
})
|
||||
@@ -1144,7 +1196,7 @@ describe('Safari: a strip command clicked with the focus left on a keyed vertex'
|
||||
async function keyedVertex() {
|
||||
await mount(squareText())
|
||||
await select()
|
||||
clickHandle('Sommet 1', [20, 20])
|
||||
clickHandle('Sommet 1 de N', [20, 20])
|
||||
act(() => vertex(1).focus())
|
||||
fireEvent.keyDown(vertex(1), { key: 'ArrowRight' })
|
||||
expect(useAnnotationWork.getState().preview?.source).toBe('keys')
|
||||
|
||||
@@ -185,7 +185,10 @@ the same layer, in this order: one « + » at the midpoint of each segment
|
||||
(wrapping from the last vertex to the first), then one vertex handle per
|
||||
vertex, then the « − » bubble of the chosen vertex, a rounded rectangle drawn
|
||||
just above that vertex. Each is a `role="button"` with `tabindex="0"`, so Tab and
|
||||
Shift+Tab walk them in document order. A « + » is not drawn while its segment
|
||||
Shift+Tab walk them in document order. They sit in one `<g role="group">` named
|
||||
« Sommets de {nom} »; each name carries the shape's display name in the current
|
||||
locale: « Sommet {n} de {nom} », « Ajouter un sommet après le sommet {n} de
|
||||
{nom} », « Retirer le sommet {n} de {nom} ». A « + » is not drawn while its segment
|
||||
is shorter than two hit radii on screen at the current zoom (R-9); Insert on
|
||||
a vertex still reaches it. The « − » bubble is `aria-disabled` and greyed
|
||||
while the polygon has three vertices. Above 40 vertices (`HANDLE_CAP`, T18)
|
||||
|
||||
@@ -816,8 +816,11 @@ Interprétations et écarts par rapport aux planches :
|
||||
de texte gardent leur propre annulation.
|
||||
|
||||
Libellés inventés pendant la construction (français / anglais) :
|
||||
- « Sommet {n} » / « Vertex {n} » ; « Ajouter un sommet après le sommet {n} » / « Add a vertex after vertex {n} » ;
|
||||
« Retirer le sommet {n} » / « Remove vertex {n} » (noms des poignées, lus par les lecteurs d'écran).
|
||||
- « Sommet {n} de {nom} » / « Vertex {n} of {name} » ; « Ajouter un sommet après le sommet {n} de {nom} » /
|
||||
« Add a vertex after vertex {n} of {name} » ; « Retirer le sommet {n} de {nom} » / « Remove vertex {n} of {name} »
|
||||
(noms des poignées, lus par les lecteurs d'écran ; {nom} est le nom de la zone dans la langue choisie, par exemple
|
||||
« Sommet 3 de Vertèbres thoraciques ») ; « Sommets de {nom} » / « Vertices of {name} » (nom du groupe des
|
||||
poignées).
|
||||
- « Accès {nom} » / « Link {name} » (nom de la poignée d'un accès).
|
||||
- « Sommet déplacé » / « Vertex moved ».
|
||||
- « Taille refusée : {texte} » / « Size refused: {text} ».
|
||||
|
||||
@@ -62,7 +62,7 @@ Implemented (plan `.claude/tasks/plans/2026-11-17-v1-2-6-u2.md`, rev 3; boards `
|
||||
| Layout (A14) | `expectNoShift` (`e2e/support/layout.ts`) at 1 024, 1 180 and 1 280 px: no box of the canvas, the strip, the aside or the header moves, `scrollHeight` and the scrollbar gutter are unchanged, and the layout-shift sum is zero around selection, strip content, a message showing and expiring, the hint, a dialog opening and closing, mode entry and exit, and the first commit's save line; `scrollbar-gutter: stable` on the editor page only (`editor-annotations.spec.ts`) |
|
||||
| Keyboard | create a zone, add and remove a vertex, move the zone, validate, without a pointer; Ctrl+Z on a focused handle after arrow moves only cancels the preview and a later Enter commits nothing stale; after undoing « + », « − » never removes the wrong vertex; « Désélectionner » commits a pending series |
|
||||
| Paths (T16) | a path annotation gets no handle, no « + » or « − », no zone move in either mode, no keyboard move; its `d` is byte-identical after every gesture on its neighbours, a save and a reload; « Remplacer par un polygone » stays the only change: explicit, validated by the core, the path kept while tracing, on Escape and on a refusal; one undo entry restoring the exact `d`, redo restoring the polygon (owner, BDR-101) |
|
||||
| Accessibility | axe on selection, tracing, move states and the dialog in read and edit modes; handle names (« Point {nom} », « Sommet {n} », « Ajouter un sommet après le sommet {n} », « Retirer le sommet {n} »); live-region message after a move; WCAG 2.5.7: the move mode with four arrow buttons is the single-pointer path without dragging (A11) |
|
||||
| Accessibility | axe on selection, tracing, move states and the dialog in read and edit modes; handle names (« Point {nom} », « Sommet {n} de {nom} », « Ajouter un sommet après le sommet {n} de {nom} », « Retirer le sommet {n} de {nom} », the handle group « Sommets de {nom} »); live-region message after a move; WCAG 2.5.7: the move mode with four arrow buttons is the single-pointer path without dragging (A11) |
|
||||
| Performance | commit latency under the 500 ms budget for drag, insert and remove, a measure run by hand at the gates (`e2e/support/measure-commit.ts`, `editor-measure-commit.spec.ts`, `MEASURE_COMMIT=1`) on a run-seeded equine-sized draft, never on the historical copy nor through `editor-equine.spec.ts`. Measured 2026-11-18 on a production build under `vite preview`, Chromium mouse at 1 280 px, CPU ×4, from the release to the painted frame showing the new geometry with the undo entry: median / max drag 176.9 / 209.2 ms, « + » 176.2 / 177.6 ms, « − » 168.2 / 170.3 ms (three runs each; figures in plan Task 10); the drag smoothness is a measure, not an assertion (`e2e/support/measure-drag.ts`, `editor-measure-drag.spec.ts`, run by hand). Measured 2026-11-18 on a production build under `vite preview`, Chromium touch at 1 180 px, CPU ×4: frame work p95 4.2 to 4.7 ms with the loupe (technique A), 4.0 to 4.4 ms outline only (B), 3.6 to 4.2 ms without a loupe; technique A kept. The figures are in plan Task 8; the owner's tablet trial is the real check |
|
||||
|
||||
## U3 · Category panel and own colour
|
||||
|
||||
Reference in new issue
Block a user