Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(cowork): expose full artifact titles

thinhlpgb1f7e9f3822d
diff --git a/web-app/src/containers/CoworkArtifactCard.tsx b/web-app/src/containers/CoworkArtifactCard.tsx
index d1df92367..19db3922f 100644
--- a/web-app/src/containers/CoworkArtifactCard.tsx
+++ b/web-app/src/containers/CoworkArtifactCard.tsx
@@ -92,7 +92,10 @@ export function CoworkArtifactCard({
)}
{/* min-w-0 on a block box: `truncate` is inert otherwise. */}
<span className="min-w-0 flex-1">
- <span className="block truncate text-sm font-medium">
+ <span
+ className="block truncate text-sm font-medium"
+ title={artifact.title}
+ >
{artifact.title}
</span>
<span className="mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground">
diff --git a/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx b/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx
new file mode 100644
index 000000000..e4b136522
--- /dev/null
+++ b/web-app/src/containers/__tests__/CoworkArtifactCard.test.tsx
@@ -0,0 +1,30 @@
+import '@testing-library/jest-dom/vitest'
+import { render, screen } from '@testing-library/react'
+import { describe, expect, it, vi } from 'vitest'
+
+vi.mock('@/i18n/react-i18next-compat', () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}))
+
+import { CoworkArtifactCard } from '../CoworkArtifactCard'
+import type { CoworkArtifact } from '@/lib/coworkArtifacts'
+
+const artifact: CoworkArtifact = {
+ path: 'reports/customer-research-summary.html',
+ title: 'customer-research-summary',
+ group: 'Code',
+ label: 'HTML',
+}
+
+describe('CoworkArtifactCard', () => {
+ it('exposes the complete artifact title when the card truncates it', () => {
+ render(
+ <CoworkArtifactCard artifact={artifact} roots={[]} onPreview={vi.fn()} />
+ )
+
+ expect(screen.getByText(artifact.title)).toHaveAttribute(
+ 'title',
+ artifact.title
+ )
+ })
+})