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')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
serverRevision,
|
||||
shapeWith,
|
||||
toolButton,
|
||||
twinSelectionTag,
|
||||
UNSAVED_LINE,
|
||||
} from '../support/editor'
|
||||
|
||||
@@ -247,7 +248,7 @@ test.describe('deselect and D6b (editor, mouse and keyboard)', () => {
|
||||
await toolButton(page, dict, 'zone').click()
|
||||
await clickAt(page, { x: 300, y: 500 })
|
||||
await clickAt(page, { x: 400, y: 500 })
|
||||
const bar = page.getByTestId('tracing-bar')
|
||||
const bar = page.getByTestId('tracing-commands')
|
||||
await expect(bar).toBeVisible()
|
||||
await box(page).focus()
|
||||
await page.keyboard.press('Escape')
|
||||
@@ -327,7 +328,8 @@ test.describe('deselect and D6b (editor, mouse and keyboard)', () => {
|
||||
] as [string, { x: number; y: number }][]) {
|
||||
await clickAt(page, at)
|
||||
await expectSelected(page, name)
|
||||
await expect(selectionTag(page)).toHaveCSS('position', 'absolute')
|
||||
// The name shows in the fixed-height strip, which never moves the drawing.
|
||||
await expect(page.getByTestId('edit-strip')).toHaveCSS('height', '64px')
|
||||
expect(await top(), `${name} selected`).toBe(before)
|
||||
await clickAt(page, IN_ROOT)
|
||||
await expectDeselected(page)
|
||||
@@ -745,23 +747,23 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => {
|
||||
|
||||
await takeRecord(page)
|
||||
await tap(cdp, await markerAt())
|
||||
await expect(selectionTag(page)).toContainText(POINT)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
await shoot(info, 'r1-panel-375', properties(page))
|
||||
await report('twin tap on a marker')
|
||||
|
||||
await takeRecord(page)
|
||||
await tap(cdp, await twinAt(IN_RECT.x, IN_RECT.y))
|
||||
await expect(selectionTag(page)).toHaveCount(0)
|
||||
await expect(twinSelectionTag(page)).toHaveCount(0)
|
||||
await expect(canvas).toBeFocused()
|
||||
await report('twin tap on the rect')
|
||||
|
||||
await tap(cdp, await markerAt())
|
||||
await expect(selectionTag(page)).toContainText(POINT)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
await takeRecord(page)
|
||||
const from = await twinAt(IN_CIRCLE.x, IN_CIRCLE.y)
|
||||
await drag(cdp, from, { x: from.x + 30, y: from.y + 10 })
|
||||
await frames(page)
|
||||
await expect(selectionTag(page)).toContainText(POINT)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
const drag1 = guards(await report('twin one-finger drag'))
|
||||
expect(drag1.clicks, 'twin drag: no click').toBe(0)
|
||||
expect(
|
||||
@@ -774,7 +776,7 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => {
|
||||
await touch(cdp, 'touchStart', [two, { x: two.x + 30, y: two.y }])
|
||||
await touch(cdp, 'touchEnd', [])
|
||||
await frames(page)
|
||||
await expect(selectionTag(page)).toContainText(POINT)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
const pair = guards(await report('twin two-finger tap'))
|
||||
expect(pair.nonPrimary, 'twin: a non-primary pointerdown').toBeGreaterThan(
|
||||
0,
|
||||
@@ -819,12 +821,12 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => {
|
||||
[LINK, { x: 825, y: 575 }],
|
||||
] as [string, { x: number; y: number }][]) {
|
||||
await tap(cdp, await twinAt(at.x, at.y))
|
||||
await expect(selectionTag(page)).toHaveCount(1)
|
||||
await expect(selectionTag(page)).toContainText(name)
|
||||
await expect(selectionTag(page)).toHaveCSS('position', 'absolute')
|
||||
await expect(twinSelectionTag(page)).toHaveCount(1)
|
||||
await expect(twinSelectionTag(page)).toContainText(name)
|
||||
await expect(twinSelectionTag(page)).toHaveCSS('position', 'absolute')
|
||||
expect(await top(), `${name} selected`).toBe(before)
|
||||
await tap(cdp, await twinAt(IN_RECT.x, IN_RECT.y))
|
||||
await expect(selectionTag(page)).toHaveCount(0)
|
||||
await expect(twinSelectionTag(page)).toHaveCount(0)
|
||||
expect(await top(), `${name} deselected`).toBe(before)
|
||||
}
|
||||
})
|
||||
@@ -850,7 +852,7 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => {
|
||||
x: marker!.x + marker!.width / 2,
|
||||
y: marker!.y + marker!.height / 2,
|
||||
})
|
||||
await expect(selectionTag(page)).toContainText(POINT)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
|
||||
const more = page.locator('#editor-tabs-more-button')
|
||||
await more.click()
|
||||
@@ -859,10 +861,13 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => {
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(more).toHaveAttribute('aria-expanded', 'false')
|
||||
await expect(more).toBeFocused()
|
||||
await expectKept(page, POINT)
|
||||
await frames(page)
|
||||
await expect(twinSelectionTag(page)).toContainText(POINT)
|
||||
|
||||
await page.keyboard.press('Escape')
|
||||
await expectDeselected(page)
|
||||
await expect(twinSelectionTag(page)).toHaveCount(0)
|
||||
await expect(properties(page)).toHaveCount(0)
|
||||
await expect(overview(page)).toBeVisible()
|
||||
await expect(liveRegion(page)).toHaveCount(1)
|
||||
expect(saves).toEqual([])
|
||||
})
|
||||
|
||||
@@ -388,9 +388,7 @@ test.describe('editor journey (owner trial steps)', () => {
|
||||
),
|
||||
})
|
||||
.click()
|
||||
await expect(page.getByTestId('annotation-selection-tag')).toContainText(
|
||||
'Point de bord',
|
||||
)
|
||||
await expect(selectionTag(page)).toContainText('Point de bord')
|
||||
await selectTab(page, dict, 'verification')
|
||||
await page
|
||||
.getByLabel(dict['editor.verification.note'])
|
||||
|
||||
Reference in new issue
Block a user