Desktop: pill tabs stay one row; tabs that do not fit go into a More menu, the active tab always stays visible

This commit is contained in:
CRTkafa 2026-10-23 09:44:43 +08:00
parent 83b8ce8869
commit 5b6d5cdac2
6 changed files with 77 additions and 10 deletions

View file

@ -0,0 +1,7 @@
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]); });