feat(editor): point handle, size slider with core minimum, move mode
HandleLayer: its own svg over the overlay, not aria-hidden; the selected
point (or link circle) gets a focusable « Point {nom} » handle whose hit
circle (data-handle) the press machine reads, sized in CSS px under zoom
(R-9, read once from any-pointer: coarse). The Task 2 stand-in (the
selected marker as its own handle) is removed.
Keys on the handle: arrows step 0.5 % of the frame (Shift x10) as a
stamped series, Enter or blur commit once, Escape drops it (R-11, R-13).
SizeSlider in the strip for a selected point and for the Point tool (A5):
the view's sizes as ticks, the core minimum as a red mark, snap 8 px,
arrows 1 %, Page Up/Down next size, one commit on release, Enter or blur;
a refusal restores the size and draws the refused place in red dashes.
« Déplacer le point » opens the move mode (board 06 B): drag anywhere or
four arrows move a preview only, clicks select nothing, « Valider la
position » commits once, « Annuler » and Escape restore; the focus comes
back to the button. Escape follows board 32 (escapeAction). The overlay
reads the preview from the work store and draws the old place in grey
dashes. Ctrl+Z now also works from a slider (not a text field).
Rewritten assertions:
- editor-annotations-tab « a finger drags the selected point »:
drag(marker('anno-a')) -> drag(pointHandle()), same expected geometry.
- editor-geometry.spec « a point inherited out of its frame is repaired
through the geometry group » (cx/cy typed 200) -> « ... repaired with
the move mode »: a partial move refused and restored (cx 110, issue
kept), then a move inside kept (issue gone, fewer errors).
This commit is contained in:
1 parent
2882821661
commit
91e94952f0
23 files changed
+1679
-149
No files matched your search
@@ -394,6 +394,109 @@ test.describe('editor annotations (A3)', () => {
|
||||
})
|
||||
}
|
||||
|
||||
test('the point (U2 Task 4): handle drag, size by a track click, the move mode', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
const actor = await openWithPoint(page, 1280)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
const swaps = ['aside-content'] as const
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await clickDrawing(page, 500, 300)
|
||||
await expect(selectionTag(page)).toContainText('Pt A')
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
const handle = page.getByRole('button', { name: 'Point Pt A' })
|
||||
await expect(handle).toHaveAttribute('tabindex', '0')
|
||||
const slider = page.getByTestId('size-slider').getByRole('slider')
|
||||
await expect(slider).toHaveValue('40')
|
||||
await expectAccessible(page, 'a selected point: handle, slider, move')
|
||||
|
||||
// The handle follows the pointer; the drop is one commit.
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await dragPoint(page, { x: 560, y: 330 })
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.moved.point'],
|
||||
)
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
expect(Math.abs(Number(await cx.inputValue()) - 560)).toBeLessThan(2)
|
||||
|
||||
// A click on the track, no drag (WCAG 2.5.7): one commit at the release.
|
||||
const r = geometryField(page, dict, 'r')
|
||||
const track = (await slider.boundingBox())!
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await page.mouse.click(
|
||||
track.x + track.width * 0.8,
|
||||
track.y + track.height / 2,
|
||||
)
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.resized'],
|
||||
)
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
expect(Number(await r.inputValue())).toBeGreaterThan(40)
|
||||
await page.keyboard.press('Control+z')
|
||||
await expect(r).toHaveValue('40')
|
||||
|
||||
// The move mode: three steps (5 units each on a 1 000 px wide frame), validated once.
|
||||
const x0 = Number(await cx.inputValue())
|
||||
await expectNoShift(
|
||||
page,
|
||||
() => button(page, 'editor.annotations.move.point').click(),
|
||||
swaps,
|
||||
)
|
||||
const right = button(page, 'editor.annotations.move.right')
|
||||
await expect(right).toBeVisible()
|
||||
await expectAccessible(page, 'the move mode')
|
||||
for (let step = 0; step < 3; step++) await right.click()
|
||||
await expect(cx).toHaveValue(String(x0))
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await button(page, 'editor.annotations.move.confirm').click()
|
||||
await expect(right).toHaveCount(0)
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
await expect(cx).toHaveValue(String(x0 + 15))
|
||||
await expect(button(page, 'editor.annotations.move.point')).toBeFocused()
|
||||
})
|
||||
|
||||
test('the point handle keeps its size in CSS px under zoom (R-9)', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1280, height: 800 })
|
||||
const actor = await editorActor('fr')
|
||||
const tiny = pointOf('p-t', 'main', { cx: 500, cy: 300, r: 4 }, 'Pt T')
|
||||
const seed = await seedDraft(actor, { shape: shapeWith(tiny) })
|
||||
await openEditor(page, dict, actor, seed.sheetId)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
await pickAnnotation(page, dict, /Pt T/)
|
||||
const hit = page.getByTestId('point-handle').locator('[data-handle]')
|
||||
const fit = (await hit.boundingBox())!
|
||||
// R-9: a 10 px hit radius with a mouse (Chromium desktop has a fine pointer).
|
||||
expect(Math.abs(fit.width - 20)).toBeLessThan(2)
|
||||
await page
|
||||
.getByRole('button', { name: dict['catalogue.zoom.in'] })
|
||||
.click()
|
||||
await expect
|
||||
.poll(async () => Math.round((await hit.boundingBox())!.width))
|
||||
.toBeLessThan(22)
|
||||
expect(Math.abs((await hit.boundingBox())!.width - 20)).toBeLessThan(2)
|
||||
})
|
||||
|
||||
test('the editor keeps a stable scrollbar gutter; the dashboard does not', async ({
|
||||
page,
|
||||
requests,
|
||||
|
||||
Reference in new issue
Block a user