mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 00:02:39 +00:00
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
resolveRightDrawerPanelWidth,
|
|
WIDE_PANEL_MAX_WIDTH,
|
|
NARROW_BACKDROP_GUTTER
|
|
} from './right-drawer-panel-width'
|
|
|
|
describe('resolveRightDrawerPanelWidth', () => {
|
|
it('caps to the wide max width on wide layouts', () => {
|
|
expect(resolveRightDrawerPanelWidth(1024, true, undefined)).toBe(WIDE_PANEL_MAX_WIDTH)
|
|
})
|
|
|
|
it('leaves a backdrop gutter on narrow layouts', () => {
|
|
expect(resolveRightDrawerPanelWidth(400, false, undefined)).toBe(400 - NARROW_BACKDROP_GUTTER)
|
|
})
|
|
|
|
it('honors an explicit widthPx but never exceeds the window width', () => {
|
|
expect(resolveRightDrawerPanelWidth(1024, true, 320)).toBe(320)
|
|
expect(resolveRightDrawerPanelWidth(280, false, 320)).toBe(280)
|
|
})
|
|
|
|
it('never returns a negative width on tiny windows', () => {
|
|
expect(resolveRightDrawerPanelWidth(20, false, undefined)).toBe(0)
|
|
})
|
|
|
|
it('clamps a negative explicit widthPx to zero', () => {
|
|
expect(resolveRightDrawerPanelWidth(400, false, -10)).toBe(0)
|
|
})
|
|
})
|