Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: the context limit zones line up with their handles and legend

The zones were drawn by percentage of the full track, but a range input's thumb travels its own range less one thumb width, and the range starts at 5. So the colour edges sat off the handles. The zones now follow the thumb's travel (a tested helper in soft-context), and the Firefox thumb has the same size as the other. The legend bars had no colour either, as the item rule reset the border colour; their rule is now more specific.
This commit is contained in:
iris 2026-11-18 22:11:04 +01:00 • committed by mara
commit d4dc8b48b1

View file

@ -3,6 +3,7 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import {
along,
MAX_SOFT_CONTEXT_PERCENT,
MIN_SOFT_CONTEXT_PERCENT,
softContextValue,
@ -26,6 +27,13 @@ test("a whole percent from 5 to 100 is taken", () => {
);
});
test("a percentage sits along the slider's range, not the full track", () => {
assert.equal(along(MIN_SOFT_CONTEXT_PERCENT), 0);
assert.equal(along(MAX_SOFT_CONTEXT_PERCENT), 100);
assert.equal(along(52.5), 50);
assert.ok(along(50) < 50);
});
test("anything else is refused", () => {
for (const text of ["0", "4", "101", "-20", "20.5", "abc", "1e1", "20%"]) {
assert.equal(softContextValue(text), null, text);