some improvements
Some checks failed
CI / check (push) Has been cancelled

This commit is contained in:
2026-09-11 11:01:57 +02:00
parent 1ebb9a0e74
commit f6a551d7c4
8 changed files with 108 additions and 63 deletions

View File

@@ -52,7 +52,7 @@ describe('a change that only removes a line', () => {
expect(c.querySelector('.ce-gutter .chg')).toBeNull()
})
it('hands the removed line to the hover panel', async () => {
it('hands the removed line to the picked panel', async () => {
const c = await openRow()
const scroll = await waitFor(() => {
const el = c.querySelector<HTMLElement>('.ce-scroll')
@@ -60,7 +60,7 @@ describe('a change that only removes a line', () => {
return el
})
// 'tail' took the place of the removed line, and sits on line 2.
fireEvent.mouseMove(scroll, { clientY: 10 + 20 + 5 })
fireEvent.click(scroll, { clientY: 10 + 20 + 5 })
const peek = await waitFor(() => {
const p = c.querySelector<HTMLElement>('.peek')
if (!p) throw new Error('peek not ready')

View File

@@ -74,7 +74,7 @@ describe('Editor view modes', () => {
expect(find(c, '.seg button.on', 'Original')).toBeTruthy()
})
it('hovering a band in Actual reveals the original, leaving the editor hides it', async () => {
it('clicking a band in Actual reveals the original, clicking it again hides it', async () => {
const c = await openChanged()
const scroll = await waitFor(() => {
const el = c.querySelector<HTMLElement>('.ce-scroll')
@@ -83,7 +83,7 @@ describe('Editor view modes', () => {
})
// Line 30 is the first rewritten line. Unwrapped, its band is arithmetic:
// a 10px top pad plus 20px per line, and the hit test reads clientY.
fireEvent.mouseMove(scroll, { clientY: 10 + 29 * 20 + 5 })
fireEvent.click(scroll, { clientY: 10 + 29 * 20 + 5 })
const peek = await waitFor(() => {
const p = c.querySelector<HTMLElement>('.peek')
if (!p) throw new Error('peek not ready')
@@ -93,7 +93,8 @@ describe('Editor view modes', () => {
expect(removed).toHaveLength(1)
expect(removed[0].textContent).toContain("'plan' => $user->plan,")
fireEvent.mouseLeave(scroll)
// A second click on the same band drops it.
fireEvent.click(scroll, { clientY: 10 + 29 * 20 + 5 })
await waitFor(() => expect(c.querySelector('.peek')).toBeNull())
})

View File

@@ -103,7 +103,7 @@ describe('a file that is staged and then edited again', () => {
expect(splitText(c, 'right')).toEqual(['a', 'STAGED', 'c', 'AFTER-STAGING'])
})
it('the hover panel behind Actual always reaches back to HEAD', async () => {
it('the picked panel behind Actual always reaches back to HEAD', async () => {
const c = await boot()
fireEvent.click(group(c, 'Changes')[0])
const scroll = await waitFor(() => {
@@ -112,7 +112,7 @@ describe('a file that is staged and then edited again', () => {
return el
})
// Line 2 is 'STAGED'. Unwrapped, its band runs from 10 + (2-1)*20.
fireEvent.mouseMove(scroll, { clientY: 10 + 20 + 5 })
fireEvent.click(scroll, { clientY: 10 + 20 + 5 })
const peek = await waitFor(() => {
const p = c.querySelector<HTMLElement>('.peek')
if (!p) throw new Error('peek not ready')
@@ -121,7 +121,8 @@ describe('a file that is staged and then edited again', () => {
const removed = Array.from(peek.querySelectorAll('.ln-row.del'))
expect(removed.map((el) => el.textContent?.replace(/^\d+/, ''))).toEqual(['b'])
fireEvent.mouseLeave(scroll)
// A click anywhere off the code drops it.
fireEvent.mouseDown(document.body)
await waitFor(() => expect(c.querySelector('.peek')).toBeNull())
})