storebound/apps/desktop/tests/tabs-fit.test.ts

7 lines
591 B
TypeScript

import { expect, test } from 'bun:test';
import { fitTabs } from '../src/ui/tabs-fit';
test('all fit: every tab, no More', () => { expect(fitTabs([100, 100, 100], 400, 0, 4, 80)).toEqual([0, 1, 2]); });
test('overflow: leading tabs until full, then More', () => { expect(fitTabs([100, 100, 100, 100], 330, 0, 4, 80)).toEqual([0, 1]); });
test('the active tab stays visible even when it is late', () => { expect(fitTabs([100, 100, 100, 100], 330, 3, 4, 80)).toEqual([0, 3]); });
test('tiny row: only the active tab', () => { expect(fitTabs([100, 100, 100], 150, 2, 4, 80)).toEqual([2]); });