Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(plugin): 覆盖已安装插件卡片的键盘激活

Dasha6491d0109e5
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
index d1135834af..ad8ebb68a2 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx
@@ -182,6 +182,33 @@ describe('GhostPluginCard', () => {
expect(onManage).not.toHaveBeenCalled();
});
+ it.each(['Enter', ' '] as const)(
+ 'opens plugin details when the card itself is activated with %s',
+ (key) => {
+ const onPrimary = vi.fn();
+ const onManage = vi.fn();
+ render(<GhostPluginCard item={commandPlugin} onPrimary={onPrimary} onManage={onManage} />);
+
+ fireEvent.keyDown(screen.getByRole('button', { name: 'Filo Google' }), { key });
+ expect(onManage).toHaveBeenCalledTimes(1);
+ expect(onPrimary).not.toHaveBeenCalled();
+ },
+ );
+
+ it.each(['Enter', ' '] as const)(
+ 'does not treat a nested pill %s as a card activation',
+ (key) => {
+ const onPrimary = vi.fn();
+ const onManage = vi.fn();
+ render(<GhostPluginCard item={commandPlugin} onPrimary={onPrimary} onManage={onManage} />);
+
+ fireEvent.keyDown(screen.getByRole('button', { name: 'settings.ghosts.page.chatAria' }), {
+ key,
+ });
+ expect(onManage).not.toHaveBeenCalled();
+ },
+ );
+
it('labels the primary button 使用 for a tab-panel plugin', () => {
const onPrimary = vi.fn();
const onManage = vi.fn();