diff --git a/src/__tests__/renderer/components/DocumentGraph/DocumentNode.test.tsx b/src/__tests__/renderer/components/DocumentGraph/DocumentNode.test.tsx index ebffe458..b78d4ce8 100644 --- a/src/__tests__/renderer/components/DocumentGraph/DocumentNode.test.tsx +++ b/src/__tests__/renderer/components/DocumentGraph/DocumentNode.test.tsx @@ -288,6 +288,19 @@ describe('DocumentNode', () => { const truncatedText = description.slice(0, 100).trim() + '...'; expect(screen.getByText(truncatedText)).toBeInTheDocument(); }); + + it('applies line clamping styles to description for overflow handling', () => { + const props = createNodeProps({ description: 'Some description text' }); + + renderWithProvider(); + + const descriptionElement = screen.getByText('Some description text'); + // Should have line clamping and word break styles + expect(descriptionElement).toHaveStyle({ + overflow: 'hidden', + wordBreak: 'break-all', + }); + }); }); describe('Selection State', () => { @@ -370,6 +383,21 @@ describe('DocumentNode', () => { }); }); + describe('Container Dimensions', () => { + it('has fixed width to prevent overflow from long content', () => { + const props = createNodeProps(); + + const { container } = renderWithProvider(); + + const nodeElement = container.querySelector('.document-node'); + expect(nodeElement).toHaveStyle({ + width: '280px', + maxWidth: '280px', + overflow: 'hidden', + }); + }); + }); + describe('Theme Integration', () => { it('uses theme background color', () => { const props = createNodeProps(); diff --git a/src/renderer/components/DocumentGraph/DocumentNode.tsx b/src/renderer/components/DocumentGraph/DocumentNode.tsx index 6cf324cb..4c71d745 100644 --- a/src/renderer/components/DocumentGraph/DocumentNode.tsx +++ b/src/renderer/components/DocumentGraph/DocumentNode.tsx @@ -94,6 +94,7 @@ export const DocumentNode = memo(function DocumentNode({ data, selected }: Docum padding: 12, minWidth: 200, maxWidth: 280, + width: 280, overflow: 'hidden' as const, boxShadow: isHighlighted ? `0 0 0 3px ${theme.colors.accent}40, 0 4px 12px ${theme.colors.accentDim}` @@ -152,8 +153,12 @@ export const DocumentNode = memo(function DocumentNode({ data, selected }: Docum lineHeight: 1.4, opacity: 0.85, overflow: 'hidden' as const, - wordBreak: 'break-word' as const, - overflowWrap: 'break-word' as const, + textOverflow: 'ellipsis' as const, + wordBreak: 'break-all' as const, + overflowWrap: 'anywhere' as const, + display: '-webkit-box' as const, + WebkitLineClamp: 3, + WebkitBoxOrient: 'vertical' as const, }), [theme.colors.textDim] );