test(tests): a resumed shape has no interior drag and no handle past 40
This commit is contained in:
1 parent
77251fa636
commit
f3c4f7baa9
1 file changed
+34
@@ -471,6 +471,40 @@ describe('« Reprendre le tracé » edits the closed shape with its handles (boa
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('an interior press-and-drag of the pending zone moves nothing (no interior drag)', async () => {
|
||||
await resumed()
|
||||
const before = untouched()
|
||||
const box = canvas()
|
||||
fireEvent.pointerDown(box, { ...mouse, clientX: 50, clientY: 50 })
|
||||
fireEvent.pointerMove(box, { ...mouse, clientX: 60, clientY: 60 })
|
||||
fireEvent.pointerMove(box, { ...mouse, clientX: 70, clientY: 70 })
|
||||
fireEvent.pointerUp(box, { ...mouse, buttons: 0, clientX: 70, clientY: 70 })
|
||||
expect(shape()).toEqual(SQUARE)
|
||||
expect(untouched()).toEqual(before)
|
||||
expect(creation()).toMatchObject({ closed: true, dialog: false })
|
||||
})
|
||||
|
||||
it('a resumed shape above 40 vertices shows no handles (the stored-zone cap)', async () => {
|
||||
// A comb of 38 teeth between two lower corners, started far from the teeth (a press near
|
||||
// the first vertex closes the tracing): 41 vertices.
|
||||
const many: Point[] = [
|
||||
[50, 95],
|
||||
[10, 80],
|
||||
...Array.from(
|
||||
{ length: 38 },
|
||||
(_, i): Point => [12 + 2 * i, 20 + (i % 2) * 5],
|
||||
),
|
||||
[90, 80],
|
||||
]
|
||||
await resumed('Tibia', many)
|
||||
expect(shape()).toHaveLength(41)
|
||||
expect(screen.queryByRole('group', { name: 'Sommets de Tibia' })).toBeNull()
|
||||
expect(
|
||||
screen.queryByRole('button', { name: /^Sommet \d+ de Tibia$/ }),
|
||||
).toBeNull()
|
||||
expect(ghost()).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('a keyboard link resumes with handles, « ce nouvel accès » while unnamed', async () => {
|
||||
const user = await mount(withDetail())
|
||||
await user.click(screen.getByRole('button', { name: 'Ajouter un accès' }))
|
||||
|
||||
Reference in new issue
Block a user