feat(webui): highlight slash commands and app mentions (#4933)

This commit is contained in:
chengyongru
2026-07-15 00:34:22 +08:00
committed by GitHub
parent 2116e32013
commit 37165b0db0
15 changed files with 459 additions and 88 deletions
+36
View File
@@ -1248,6 +1248,42 @@ describe("ThreadComposer", () => {
expect(logo.className).not.toContain("-top-");
});
it("uses the shared accent when an installed CLI app has no brand metadata", () => {
const mention = "@obsidian-agent-cli";
const app: CliAppInfo = {
name: "obsidian-agent-cli",
display_name: "Obsidian CLI",
category: "productivity",
description: "Obsidian automation",
requires: "",
source: "local",
entry_point: "obsidian-agent",
install_supported: true,
installed: true,
available: true,
status: "installed",
logo_url: null,
brand_color: null,
skill_installed: true,
};
render(
<ThreadComposer
onSend={vi.fn()}
placeholder="Type your message..."
cliApps={[app]}
/>,
);
const input = screen.getByLabelText("Message input");
fireEvent.change(input, {
target: { value: mention, selectionStart: mention.length },
});
const token = screen.getByTestId("composer-cli-mention-obsidian-agent-cli");
expect(token.getAttribute("style")).toContain("var(--inline-token-highlight)");
expect(token.getAttribute("style")).not.toContain("var(--primary)");
});
it("opens the slash command palette downward when there is more room below", async () => {
vi.spyOn(HTMLFormElement.prototype, "getBoundingClientRect").mockReturnValue(
rect({ top: 40, bottom: 160, width: 800, height: 120 }),