Download desktop/src/components/chat/UserMessage.test.tsx from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 833 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/components/chat/UserMessage.test.tsx
- Command line
-
hf download hf://chenbhao/codev@e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/components/chat/UserMessage.test.tsx
-
curl -L -o UserMessage.test.tsx https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/components/chat/UserMessage.test.tsx
833 Bytes
| import { render, screen } from '@testing-library/react' | |
| import { describe, expect, it } from 'vitest' | |
| import { UserMessage } from './UserMessage' | |
| describe('UserMessage', () => { | |
| it('keeps long URLs inside the message bubble', () => { | |
| const longUrl = `https://cn.bing.com/search?q=${'encoded'.repeat(60)}` | |
| const { container } = render(<UserMessage content={longUrl} />) | |
| const shell = container.querySelector('[data-message-shell="user"]') | |
| const bubble = screen.getByText(longUrl) | |
| expect(shell?.className).toContain('min-w-0') | |
| expect(bubble.className).toContain('min-w-0') | |
| expect(bubble.className).toContain('max-w-full') | |
| expect(bubble.className).toContain('whitespace-pre-wrap') | |
| expect(bubble.style.overflowWrap).toBe('anywhere') | |
| expect(bubble.style.wordBreak).toBe('break-word') | |
| }) | |
| }) | |