feat(editor): fixed edit strip and message line without layout shift
U2 Task 3 (A6, A14, R-2). A fixed-height strip over the drawing and the right column replaces the tool line, the sr-only selection tag of the edit body and TracingBar: lead (name + status, type + detail), notice (refusal, first geometry issue + n, unmeasured view with its link, no category, no child view), commands (Fermer le trace, Retirer le dernier sommet, Annuler le trace). A fixed-height line under the drawing holds the add buttons and the gesture message: a kept drop says « Point deplace » with « Defaire » (same store undo as the header), a refused drop says « Deplacement refuse : ... » as a red alert. 6 s, held by mouse hover and focus inside, closed by any commit, undo or redo. trace_pop and Backspace remove the last vertex. The busy « Aller a » target is the strip's tracing commands. scrollbar-gutter stable, scoped to the editor. e2e helper expectNoShift (boxes, scroll height, gutter, client width, layout-shift sum). DraftHeader untouched: no shift seen. Rewritten assertions (old -> new): - tab unit « Sélection : point » on annotation-selection-tag -> strip detail « Point » - tab unit tag sr-only, not live -> strip lead outside any live region - tab unit « 1 sommet posé. » -> « 1 sommet posé » (board 04 wording) - tab unit D6b tag present / « zone » -> strip detail « Point » / « Zone · 3 sommets » - keep-alive, sections, escape units: tracing-bar -> tracing-commands - e2e selectionTag helper -> strip title with data-selection; the twin's tag is twinSelectionTag (deselect 375 px describe) - e2e deselect « tag position absolute » (edit) -> strip height 64 px, drawing top unchanged; twin Escape test keeps tag 0, properties 0, overview visible - e2e deselect and journey tracing-bar / annotation-selection-tag -> tracing-commands / selectionTag - e2e historyButton scoped to history-buttons (the message's « Défaire » has the same accessible name)
This commit is contained in:
1 parent
b2d78f9621
commit
1deb037fac
23 files changed
+1228
-181
No files matched your search
@@ -11,13 +11,18 @@ import {
|
||||
pressAtBox,
|
||||
openEditor,
|
||||
pickAnnotation,
|
||||
pointOf,
|
||||
saveDraft,
|
||||
saveLine,
|
||||
seedDraft,
|
||||
selectionTag,
|
||||
selectTab,
|
||||
serverDocument,
|
||||
shapeWith,
|
||||
standardShape,
|
||||
UNSAVED_LINE,
|
||||
} from '../support/editor'
|
||||
import { expectNoShift } from '../support/layout'
|
||||
|
||||
// V1-2.6 A3 (contract C7, C8, C21): points, zones and links by clicks and by keyboard,
|
||||
// move by drag, numeric edits, undo and redo, then the save that carries them.
|
||||
@@ -286,4 +291,120 @@ test.describe('editor annotations (A3)', () => {
|
||||
await selectTab(page, dict, 'verification')
|
||||
await expectAccessible(page, 'the verification tab after a deletion')
|
||||
})
|
||||
|
||||
test.describe('the drawing never moves (A14)', () => {
|
||||
const button = (page: Page, key: string) =>
|
||||
page.getByRole('button', { name: dict[key], exact: true })
|
||||
const line = (page: Page) => page.getByTestId('gesture-line')
|
||||
|
||||
async function openWithPoint(page: Page, width: number) {
|
||||
await page.setViewportSize({ width, height: 800 })
|
||||
// Installed before any timer: the message's 6 s run on this clock (fast-forwarded below).
|
||||
await page.clock.install()
|
||||
const actor = await editorActor('fr')
|
||||
const point = pointOf('p-a', 'main', { cx: 500, cy: 300, r: 40 }, 'Pt A')
|
||||
const seed = await seedDraft(actor, { shape: shapeWith(point) })
|
||||
await openEditor(page, dict, actor, seed.sheetId)
|
||||
await expect(tool(page, 'point')).toBeEnabled()
|
||||
return actor
|
||||
}
|
||||
|
||||
/** A drag of the point from (500, 300) to `to`, in drawing units. */
|
||||
async function dragPoint(page: Page, to: { x: number; y: number }) {
|
||||
const from = await clientOf(page, 500, 300)
|
||||
const end = await clientOf(page, to.x, to.y)
|
||||
await page.mouse.move(from.x, from.y)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(end.x, end.y, { steps: 6 })
|
||||
await page.mouse.up()
|
||||
}
|
||||
|
||||
for (const width of [1024, 1180, 1280]) {
|
||||
test(`at ${width} px: selection, tools, tracing, the first commit, the message`, async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
const actor = await openWithPoint(page, width)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
// shortcut: the side panel still swaps the overview for the properties or the
|
||||
// creation panel until Tasks 6 and 7 (dialogs); its height is exempt there only.
|
||||
const swaps = ['aside-content'] as const
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await clickDrawing(page, 500, 300)
|
||||
await expect(selectionTag(page)).toContainText('Pt A')
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
// The first commit: the save line changes, the message shows (the properties panel
|
||||
// rewrites its review badge: aside content until Task 6).
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await dragPoint(page, { x: 560, y: 330 })
|
||||
await expect(line(page)).toContainText(
|
||||
dict['editor.annotations.message.moved.point'],
|
||||
)
|
||||
await expect(saveLine(page)).toHaveText(UNSAVED_LINE)
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
// Its expiry, 6 s later.
|
||||
await expectNoShift(page, async () => {
|
||||
await page.clock.fastForward(6_100)
|
||||
await expect(line(page)).not.toContainText(
|
||||
dict['editor.annotations.message.moved.point'],
|
||||
)
|
||||
})
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await clickDrawing(page, 20, 20)
|
||||
await expect(selectionTag(page)).toHaveCount(0)
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
await expectNoShift(page, () => tool(page, 'zone').click())
|
||||
await expectNoShift(page, () => clickDrawing(page, 600, 150))
|
||||
for (const [x, y] of [
|
||||
[800, 150],
|
||||
[700, 400],
|
||||
])
|
||||
await expectNoShift(page, () => clickDrawing(page, x, y))
|
||||
await expectNoShift(page, () =>
|
||||
button(page, 'editor.annotations.trace_pop').click(),
|
||||
)
|
||||
await expectNoShift(page, () => clickDrawing(page, 700, 400))
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
await button(page, 'editor.annotations.trace_close').click()
|
||||
await expect(creation(page)).toBeVisible()
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
test('the editor keeps a stable scrollbar gutter; the dashboard does not', async ({
|
||||
page,
|
||||
requests,
|
||||
}, info) => {
|
||||
test.skip(
|
||||
info.project.name !== 'chromium-desktop',
|
||||
'measured at 1 280 px',
|
||||
)
|
||||
const actor = await openWithPoint(page, 1280)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
const gutter = () =>
|
||||
page.evaluate(
|
||||
() => getComputedStyle(document.documentElement).scrollbarGutter,
|
||||
)
|
||||
expect(await gutter()).toBe('stable')
|
||||
await page.goto('/app')
|
||||
await expect(page.locator('[data-editor-workspace]')).toHaveCount(0)
|
||||
expect(await gutter()).toBe('auto')
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user