deer-flow/frontend/tests/unit/core/extensions/mentions.dom.test.ts
Wenchao An 59b051b0fd
feat(frontend): support extension providers in composer mentions (#6189)
* feat(frontend): support extension providers in composer mentions

* fix(mentions): retain settled plugin suggestions during search

* fix(extensions): validate identifiers and skip empty mention searches

* test: stabilize history pagination after latest page refresh

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-10-03 20:30:23 +08:00

33 lines
1.1 KiB
TypeScript

import { expect, it } from "@rstest/core";
import {
referenceToken,
renderReferenceEditor,
} from "@/components/workspace/mentions/inline-references";
import { extensionMentionId } from "@/core/extensions/mentions";
it("renders plugin references with a distinct glyph and color from conversations", () => {
const root = document.createElement("div");
const plugin = referenceToken(
"extension",
extensionMentionId({
namespace: "community.team",
provider: "people",
id: "alice",
label: "Alice",
}),
"Alice",
);
const conversation = referenceToken("conversation", "thread", "Conversation");
renderReferenceEditor(root, `${plugin} ${conversation}`);
const extensionChip = root.querySelector<HTMLElement>(
'[data-reference-kind="extension"]',
)!;
const conversationChip = root.querySelector<HTMLElement>(
'[data-reference-kind="conversation"]',
)!;
expect(extensionChip.firstElementChild?.textContent).toBe("◈");
expect(conversationChip.firstElementChild?.textContent).toBe("◉");
expect(extensionChip.className).not.toBe(conversationChip.className);
});