Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/swarm-ui/test/dropdown-edge.test.mjs
iris 608eb9dcd9 shared: a dropdown that would run past the window's right edge hangs from the right of its trigger
The state menu on an agent card that fills the width hung from the
trigger's left edge, so the window cut the list off. The list now measures
itself when it opens and flips to the trigger's right edge when it would
overflow.
2026-11-27 17:10:27 +01:00

12 lines
447 B
JavaScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { hangsFromEnd } from "../../shared/src/dropdown/edge.ts";
test("a list that ends inside the window stays hung from the left", () => {
assert.equal(hangsFromEnd(300, 1000), false);
assert.equal(hangsFromEnd(1000, 1000), false);
});
test("a list that ends past the window edge hangs from the right", () => {
assert.equal(hangsFromEnd(1001, 1000), true);
});