Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Tests: the agenda card check waits for its opening fade before scrolling

Eric Brownrouta8695a75eb72
diff --git a/app/e2e/agendaCard.spec.ts b/app/e2e/agendaCard.spec.ts
index 746c6a3e..bafeec7c 100644
--- a/app/e2e/agendaCard.spec.ts
+++ b/app/e2e/agendaCard.spec.ts
@@ -144,6 +144,8 @@ test('a bottom event opens above its row, tracks scrolling, flips without chatte
await expect(row).toHaveCSS('transition-duration', '0s')
await row.click({ position: { x: 20, y: 8 } })
await expect(card).toHaveAttribute('data-side', 'top')
+ // Reduced motion keeps the opening opacity fade; settle it before testing the flip.
+ await card.evaluate(el => Promise.allSettled(el.getAnimations().map(a => a.finished)))
await placeRow('top')
const reducedTop = await geometry()
expect(reducedTop.roomBelow - reducedTop.roomAbove).toBeGreaterThan(24)
diff --git a/app/test/agendaCard.test.ts b/app/test/agendaCard.test.ts
index 75da26da..280c4b6c 100644
--- a/app/test/agendaCard.test.ts
+++ b/app/test/agendaCard.test.ts
@@ -1,12 +1,53 @@
import { readFileSync } from 'node:fs'
-import { describe, expect, it } from 'vitest'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { autoUpdate, computePosition } from '@floating-ui/dom'
import { agendaCardSide, agendaCardSpace } from '../src/shared/agendaCard'
+import { positionAgendaCard } from '../src/renderer/src/useAgendaCard'
+
+vi.mock('@floating-ui/dom', async original => ({
+ ...await original<typeof import('@floating-ui/dom')>(), autoUpdate: vi.fn(), computePosition: vi.fn(),
+}))
+afterEach(() => { vi.unstubAllGlobals(); vi.clearAllMocks() })
const column = { top: 50, bottom: 750, left: 800, right: 1100 }
const list = { top: 270, bottom: 720, left: 820, right: 1080 }
const viewport = { width: 1100, height: 760 }
const row = (top: number, bottom: number) => ({ top, bottom, left: 820, right: 1080 })
+it.each([false, true])('tracks scrolling immediately and only animates flips without reduced motion (reduced: %s)', async reduced => {
+ let update = () => {}, top = 650
+ const stop = vi.fn(), cancel = vi.fn(), animate = vi.fn(() => ({ cancel }))
+ vi.mocked(autoUpdate).mockImplementation((_row, _el, callback) => { update = callback; return stop })
+ vi.mocked(computePosition).mockImplementation(async (_row, _el, { placement = 'bottom' } = {}) => ({
+ x: 8, y: placement === 'top' ? top - 212 : top + 72, placement, strategy: 'absolute', middlewareData: {},
+ }))
+ vi.stubGlobal('innerWidth', viewport.width)
+ vi.stubGlobal('innerHeight', viewport.height)
+ vi.stubGlobal('getComputedStyle', () => ({ paddingTop: '16', paddingBottom: '16', rowGap: '16', marginTop: '0', marginBottom: '0' }))
+ const content = { style: {}, children: [{ getBoundingClientRect: () => ({ height: 100 }) }], querySelector: () => null }
+ const tip = { style: {} }
+ const el = { style: { top: '0px', visibility: 'hidden' }, dataset: { side: '' }, animate,
+ getBoundingClientRect: () => ({ top: parseFloat(el.style.top) }),
+ querySelector: (selector: string) => selector === '.agenda-inspector-arrow' ? tip : content,
+ }
+ const cleanup = positionAgendaCard(el as unknown as HTMLElement,
+ { isConnected: true, getBoundingClientRect: () => row(top, top + 60) } as HTMLElement,
+ { getBoundingClientRect: () => list } as HTMLElement,
+ { getBoundingClientRect: () => ({ ...column, x: column.left, y: column.top, width: 300, height: 700 }) } as HTMLElement,
+ vi.fn(), reduced)
+ try {
+ for (const [rowTop, side, flips] of [[650, 'top', 0], [618, 'top', 0], [280, 'bottom', 1], [650, 'top', 2]] as const) {
+ top = rowTop
+ update()
+ await Promise.resolve()
+ expect(el.dataset.side).toBe(side)
+ expect(el.style.top).toBe(`${side === 'top' ? top - 212 : top + 72}px`)
+ expect(animate).toHaveBeenCalledTimes(reduced ? 0 : flips)
+ }
+ } finally { cleanup() }
+ expect(stop).toHaveBeenCalledOnce()
+})
+
it('left-aligns a single agenda-card action with the icon column and keeps the 16px divider rhythm', () => {
const css = readFileSync(new URL('../src/renderer/src/workspace.css', import.meta.url), 'utf8')
expect(css).toMatch(/\.agenda-inspector \.agenda-inspector-actions:has\(>:only-child\) \{ justify-content:flex-start; \}/)