feat(editor): Backspace and « + » on a vertex handle

This commit is contained in:
bchanot committed 2026-11-19 11:16:55 +01:00
1 parent c01c6f3145
commit 6df66f9bb9
5 files changed
+108 -10

No files matched your search

+45
View File
@@ -169,6 +169,51 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
await undoTo(page, () => shownPoints(page), stored)
})
test('Thoraciques: Backspace and « + » on a vertex, each undone, the group named in full', async ({
page,
requests,
}) => {
const actor = await openThoracic(page)
requests.forbid(actor.account.email, actor.account.password)
await pickAnnotation(page, dict, THORACIC)
await scrollToTop(page)
// Point 5: the group and a vertex carry the annotation's full name.
await expect(
page.getByRole('group', {
name: 'Sommets de Vertèbres thoraciques',
exact: true,
}),
).toBeAttached()
const stored = await shownPoints(page)
const third = handle(page, 'Sommet 3 de Vertèbres thoraciques')
await expect(third).toBeAttached()
// Backspace removes the focused vertex, as Delete; undone.
await third.focus()
await page.keyboard.press('Backspace')
await expect(line(page)).toContainText(
dict['editor.annotations.message.vertex_removed'],
)
expect(await count(page)).toBe(stored.length - 1)
await undoTo(page, () => shownPoints(page), stored)
// « + » adds after the focused vertex, as Insert, the canvas zoom untouched; undone.
// The undo cleared the choice but left the focus: moving it chooses again.
await handle(page, 'Sommet 2 de Vertèbres thoraciques').focus()
await handle(page, 'Sommet 3 de Vertèbres thoraciques').focus()
const drawing = page.getByTestId('annotation-canvas-drawing').locator('..')
const framed = () =>
drawing.evaluate((el) => getComputedStyle(el).transform)
const zoomed = await framed()
await page.keyboard.press('+')
await expect(line(page)).toContainText(
dict['editor.annotations.message.vertex_added'],
)
expect(await count(page)).toBe(stored.length + 1)
expect(await framed()).toBe(zoomed)
await undoTo(page, () => count(page), stored.length)
})
test('Thoraciques: « Désélectionner » commits the arrow steps pending on a vertex', async ({
page,
requests,