import { describe, expect, it } from "vitest"; import { moveActive, shortcutLabel } from "#lib/components/shell/topbarSearch.ts"; describe("moveActive", () => { it("steps through the results without wrapping", () => { expect(moveActive(-1, 1, 3)).toBe(0); expect(moveActive(1, 1, 3)).toBe(2); expect(moveActive(2, 1, 3)).toBe(2); }); it("returns to the input above the first result", () => { expect(moveActive(0, -1, 3)).toBe(-1); expect(moveActive(-1, -1, 3)).toBe(-1); }); it("stays on the input when there are no results", () => { expect(moveActive(-1, 1, 0)).toBe(-1); }); }); describe("shortcutLabel", () => { it("names the platform's modifier", () => { expect(shortcutLabel(true)).toBe("⌘K"); expect(shortcutLabel(false)).toBe("Ctrl+K"); }); });