fix(editor): veil ignores clicks, names merged apart, honest tests

U2 Task 6 fix round 1 (review minors 1 to 9).

- R-6: `Dialog` takes `veilCloses`; the annotation dialog passes false,
  so its veil ignores clicks centred too. Other dialogs unchanged.
- Save merges each name on its own (an EN refreshed meanwhile survives
  an FR-only edit); the merged annotation is typed per kind, no cast.
- Tests: the category change and the region row really run (a second
  category and a region in the fixture); EN kept under an FR edit;
  focus to the drawing when a filter hides the row; a centred veil
  ignores a click; act() around the store write; ui.Dialog restores
  innerHeight and visualViewport after each test.
- e2e: `pickAnnotation` no longer scrolls; `scrollToTop` is explicit
  where a low row leaves the drawing out of view (editor-zones x3,
  editor-geometry). editor-geometry runs the accepted repair from the
  page's end, buttons pressed in place, scroll unchanged. The touch
  and double-click tests wait on the clicks themselves; the stray
  click on the veil can fail.
- CreationPanel's `required.fields` recorded as a shortcut for Task 7;
  TODO lines updated. focusTarget comment wrapped.
This commit is contained in:
bchanot committed 2026-11-17 22:47:02 +01:00
1 parent db3f306523
commit 9a0fe3784c
12 files changed
+234 -58

No files matched your search

+19 -2
View File
@@ -1,4 +1,4 @@
import { describe, it, expect, vi } from 'vitest'
import { afterEach, describe, it, expect, vi } from 'vitest'
import { useState } from 'react'
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
@@ -251,6 +251,13 @@ describe('Dialog anchored over a column', () => {
configurable: true,
value,
})
const height = window.innerHeight
const viewport = Object.getOwnPropertyDescriptor(window, 'visualViewport')
afterEach(() => {
window.innerHeight = height
if (viewport) Object.defineProperty(window, 'visualViewport', viewport)
else withViewport(undefined)
})
it('sits at the anchor’s left and width, from its top, down to 12 px above the bottom', () => {
withViewport(undefined)
@@ -297,7 +304,6 @@ describe('Dialog anchored over a column', () => {
expect(panel().style.top).toBe('12px')
expect(panel().style.height).toBe('326px')
expect(panel().style.left).toBe('900px')
withViewport(undefined)
})
it('without an anchor box the panel is centred, as before', () => {
@@ -330,4 +336,15 @@ describe('Dialog anchored over a column', () => {
await userEvent.click(screen.getByTestId('dialog-backdrop'))
expect(onClose).toHaveBeenCalled()
})
it('a centred dialog whose veil must not close (R-6) ignores its clicks too', async () => {
const onClose = vi.fn()
render(
<Dialog open veilCloses={false} onClose={onClose} title="X">
body
</Dialog>,
)
await userEvent.click(screen.getByTestId('dialog-backdrop'))
expect(onClose).not.toHaveBeenCalled()
})
})