Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920import { describe, expect, it } from "vitest";import { moveActive } 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); });});