mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-28 22:51:09 +00:00
* feat(control-ui): agent identity editor, settings-homed agents page, chip switcher pinning * test(control-ui): pinned-agent persistence coverage; persist pins only when set * refactor(control-ui): split agent menu, identity actions, model staging out of oversized files * chore(i18n): sync control-ui locale bundles for agent identity/switcher keys * fix(control-ui): stabilize new sidebar switcher tests; ratchet LOC + export baselines * chore(review): document identity clear limitation; drop unused export * feat(control-ui): scope pages to selected agent * fix(control-ui): keep scoped page state consistent * docs(control-ui): explain shared agent scope * fix(control-ui): reconcile agent scope with current ui * fix(control-ui): preserve complete agent filtering * fix(control-ui): bound uploaded agent avatars * test(control-ui): keep pinned-route fixture valid * test(control-ui): keep pinned-route fixture valid * chore(i18n): sync locale bundles for agent scoping keys
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { render } from "lit";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import type { AgentSelectionCapability } from "../app/agent-selection.ts";
|
|
import { renderAgentScopeControl } from "./agent-scope-control.ts";
|
|
|
|
describe("renderAgentScopeControl", () => {
|
|
it("includes historical agent ids that are absent from the configured roster", () => {
|
|
const container = document.createElement("div");
|
|
const setScope = vi.fn();
|
|
const selection = {
|
|
state: { selectedId: "main", scopeId: null },
|
|
set: vi.fn(),
|
|
setScope,
|
|
subscribe: vi.fn(),
|
|
} as unknown as AgentSelectionCapability;
|
|
|
|
render(
|
|
renderAgentScopeControl({
|
|
agents: [{ id: "main", name: "Main agent" }],
|
|
additionalAgentIds: ["retired"],
|
|
selection,
|
|
}),
|
|
container,
|
|
);
|
|
|
|
const select = container.querySelector("select");
|
|
expect(Array.from(select?.options ?? []).map((option) => option.value)).toEqual([
|
|
"",
|
|
"main",
|
|
"retired",
|
|
]);
|
|
|
|
if (!(select instanceof HTMLSelectElement)) {
|
|
throw new Error("expected agent scope select");
|
|
}
|
|
select.value = "retired";
|
|
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
expect(setScope).toHaveBeenCalledWith("retired");
|
|
});
|
|
});
|