Files
orca/src/shared/ui-zoom-level.test.ts
T
Brennan Benson e09ed30a0b fix(dashboard-popout): zoom the pop-out window, not the main window behind it (#9769)
* fix(dashboard-popout): zoom the pop-out window, not the main window behind it

The View menu's zoom handlers always sent terminal:zoom to the main
window, so zooming while the dashboard pop-out was focused zoomed the
window behind it. The pop-out also never applied the persisted
uiZoomLevel, so it always rendered at 100% in a zoomed app.

The pop-out now applies uiZoomLevel on dom-ready and follows app-zoom
changes while open (main-window zoom, settings control, mobile ui.set).
Menu zoom routes to the pop-out when it is the focused window, stepping
its own webContents zoom, and a narrow before-input-event handler
resolves the zoom.in/out/reset chords (honoring keybinding overrides)
since the pop-out has no renderer-side shortcut plumbing. The step/clamp
constants move to shared/ui-zoom-level.ts so main and renderer share one
definition.

* fix(dashboard-popout): isolate window zoom

* fix(dashboard-popout): deny unused permissions

* docs(dashboard-popout): clarify wheel zoom path
2026-07-21 14:55:14 -07:00

20 lines
705 B
TypeScript

import { describe, expect, it } from 'vitest'
import { stepUIZoomLevel, UI_ZOOM_MAX, UI_ZOOM_MIN, UI_ZOOM_STEP } from './ui-zoom-level'
describe('stepUIZoomLevel', () => {
it('steps by one increment in each direction', () => {
expect(stepUIZoomLevel(0, 'in')).toBe(UI_ZOOM_STEP)
expect(stepUIZoomLevel(0, 'out')).toBe(-UI_ZOOM_STEP)
})
it('clamps to the supported range', () => {
expect(stepUIZoomLevel(UI_ZOOM_MAX, 'in')).toBe(UI_ZOOM_MAX)
expect(stepUIZoomLevel(UI_ZOOM_MIN, 'out')).toBe(UI_ZOOM_MIN)
})
it('reset returns the 100% level regardless of current', () => {
expect(stepUIZoomLevel(3, 'reset')).toBe(0)
expect(stepUIZoomLevel(-2, 'reset')).toBe(0)
})
})