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.

721 B
Raw Blame
import { describe, expect, it } from "vitest";
import { actionToggled, executeAction, getAction, registerAction } from "@/platform/actions";

describe("toggle actions", () => {
  it("reports state only for actions with `toggled`", async () => {
    let on = false;
    const dispose = registerAction({ id: "test.toggle", title: "T", toggled: () => on, run: () => void (on = !on) });
    registerAction({ id: "test.plain", title: "P", run: () => undefined });
    expect(actionToggled(getAction("test.toggle"))).toBe(false);
    await executeAction("test.toggle");
    expect(actionToggled(getAction("test.toggle"))).toBe(true);
    expect(actionToggled(getAction("test.plain"))).toBeUndefined();
    dispose();
  });
});