The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): room inline-code coverage runs the real stylesheet cascade
teknium1f50384cf65b7
diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat-inline-code.test.ts b/apps/desktop/src/plugins/hermes-bots/group-chat-inline-code.test.tsdeleted file mode 100644index 88b627eee50..00000000000--- a/apps/desktop/src/plugins/hermes-bots/group-chat-inline-code.test.ts+++ /dev/null@@ -1,14 +0,0 @@-import { readFileSync } from 'node:fs'-import { join } from 'node:path'--import { expect, it } from 'vitest'--const styles = readFileSync(join(process.cwd(), 'src/styles.css'), 'utf8')-const groupChatView = readFileSync(join(process.cwd(), 'src/plugins/hermes-bots/group-chat-view.tsx'), 'utf8')--it('uses theme-backed inline-code colors in Bot Mode group-chat messages', () => {- expect(groupChatView).toContain('data-slot="group-chat-message-content"')- expect(styles).toMatch(- /\[data-slot='group-chat-message-content'\][\s\S]*?:not\(pre\) > code[\s\S]*?background: var\(--ui-inline-code-background\);[\s\S]*?color: var\(--ui-inline-code-foreground\);/- )-})diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat-view.inline-code.test.tsx b/apps/desktop/src/plugins/hermes-bots/group-chat-view.inline-code.test.tsxnew file mode 100644index 00000000000..6a64a629adb--- /dev/null+++ b/apps/desktop/src/plugins/hermes-bots/group-chat-view.inline-code.test.tsx@@ -0,0 +1,86 @@+import { readFileSync } from 'node:fs'+import { dirname, resolve } from 'node:path'+import { fileURLToPath } from 'node:url'++import { cleanup, render } from '@testing-library/react'+import type { ReactNode } from 'react'+import { afterEach, beforeAll, expect, it, vi } from 'vitest'++import { translateBots } from './i18n-test-helper'++// Room bodies render through the shell's message renderer, whose markdown+// root is `aui-md prose` — the same container the 1:1 chat uses, minus the+// `[data-slot='aui_assistant-message-content']` ancestor that scopes the+// themed inline-code rule in styles.css. Without a room-owned hook the room's+// `<code>` falls through to Tailwind Typography's fixed near-black ink, which+// is invisible on every dark theme (#114086). The stubs below emit the two+// shapes the room can produce (renderer path, raw Streamdown fallback) so the+// real stylesheet's cascade decides, not a regex over the source text.+vi.mock('@hermes/plugin-sdk', async () => {+ const { pluginSdkMock, createGroupGateway } = await import('./group-test-utils')+ const base = await pluginSdkMock(createGroupGateway().host)++ const Button = ({ children, onClick, title }: { children?: ReactNode; onClick?: () => void; title?: string }) => (+ <button onClick={onClick} title={title}>+ {children}+ </button>+ )++ return {+ ...base,+ Button,+ RowButton: Button,+ cn: (...values: unknown[]) => values.filter(Boolean).join(' '),+ Codicon: () => null,+ CopyButton: () => null,+ ConfirmDialog: () => null,+ Dialog: () => null,+ DialogContent: () => null,+ DialogDescription: () => null,+ DialogFooter: () => null,+ DialogHeader: () => null,+ DialogTitle: () => null,+ Input: () => null,+ MessageTextContent: ({ text }: { text: string }) => (+ <div className="aui-md prose">+ <p>+ set <code data-testid="renderer-code">{text}</code> first+ </p>+ </div>+ ),+ Tip: ({ children }: { children: ReactNode }) => children,+ relativeTime: () => 'now',+ useI18n: () => ({ t: { common: { cancel: 'Cancel', save: 'Save' } } }),+ usePluginI18n: () => translateBots+ }+})+vi.mock('./avatar', () => ({ avatarColor: () => '#888', botAppearance: () => ({}), BotFace: () => null }))+vi.mock('./group-chat-parts', () => ({+ GroupClarifyCard: () => null,+ GroupImageControls: () => null,+ GroupMentionInput: () => null+}))++const STYLES = resolve(dirname(fileURLToPath(import.meta.url)), '../../styles.css')++beforeAll(() => {+ Element.prototype.scrollIntoView = vi.fn()+ const sheet = document.createElement('style')+ sheet.textContent = readFileSync(STYLES, 'utf8')+ document.head.appendChild(sheet)+})+afterEach(cleanup)++it('themes inline code in room message bodies with the chat inline-code tokens', async () => {+ const { $groupChats } = await import('./group-chat')+ const { GroupChatWorkspace } = await import('./group-chat-view')++ const log = [{ id: 'm1', thread: 'a', from: { kind: 'member' as const, name: 'builder' }, text: 'discover_models', at: 1 }]+ $groupChats.set({ Room: { log, watermarks: {}, sessions: {} } })++ const { getByTestId } = render(<GroupChatWorkspace group="Room" members={[{ name: 'builder' }] as never} />)+ const style = getComputedStyle(getByTestId('renderer-code'))++ expect(style.color).toBe('var(--ui-inline-code-foreground)')+ expect(style.background).toBe('var(--ui-inline-code-background)')+})