Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

828 B
Raw Blame
import { describe, expect, it } from "vitest";
import { reorderedTabs } from "./windowGroups";

describe("project window order", () => {
  const tabs = ["a", "b", "c"].map((label) => ({ label, name: label, current: label === "b", root: `/${label}` }));
  it("moves a tab across its neighbours without changing the source or active window", () => {
    expect(reorderedTabs(tabs, "a", "c")).toEqual(["b", "c", "a"]);
    expect(reorderedTabs(tabs, "c", "a")).toEqual(["c", "a", "b"]);
    expect(tabs.map((t) => t.label)).toEqual(["a", "b", "c"]);
    expect(tabs.find((t) => t.current)?.label).toBe("b");
  });
  it("ignores external drags and missing targets", () => {
    expect(reorderedTabs(tabs, "outside", "b")).toEqual(["a", "b", "c"]);
    expect(reorderedTabs(tabs, "a", "outside")).toEqual(["a", "b", "c"]);
  });
});