Files
Portfolio/tests/unit/nav-bar-hue.test.ts
LucaP a505a31f31 feat: make the edge-lit LCD the site's nav bar
nav-bar.css (after gantry.css) draws the bargraph, caret, indicator,
chapter drop and ripple, route glints, brake, self-test and shimmer in
LCD pixels under gantry's mask, and masks the wave to the lower bezel.
Rules hang off html:root, the same weight the preview attribute had, so
they still beat gantry.css.

useNavBarSignals mirrors the speedometer, drive controls and chapter
onto the bar, writing only on change; the per-frame speed pair goes on
the LCD and wave rather than the nav, which keeps the per-frame restyle
small. SiteNavigation renders just the parts the bar uses.
2026-10-13 06:48:33 +03:00

20 lines
623 B
TypeScript

import { describe, expect, it } from 'vitest';
import { hueTier } from '@/composables/useNavBarSignals';
describe('nav bar hue tier', () => {
it('comes on at 80, 88 and 95 % of the dial', () => {
expect(hueTier(0, 0.79)).toBe(0);
expect(hueTier(0, 0.8)).toBe(1);
expect(hueTier(0, 0.88)).toBe(2);
expect(hueTier(0, 1)).toBe(3);
});
it('holds a tier until the speed falls below its own floor', () => {
expect(hueTier(1, 0.77)).toBe(1);
expect(hueTier(1, 0.75)).toBe(0);
expect(hueTier(3, 0.93)).toBe(3);
expect(hueTier(3, 0.9)).toBe(2);
expect(hueTier(3, 0.4)).toBe(0);
});
});