mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-30 17:50:07 +08:00
fix(ui): truncate actor metadata in profile cards
This commit is contained in:
@@ -152,7 +152,7 @@ test.describe('File table responsive columns', () => {
|
||||
await expect(details.getByTitle(creatorName!)).toBeVisible()
|
||||
})
|
||||
|
||||
test('desktop: creator hover card contains long identity fields @desktop', async ({ page }) => {
|
||||
test('desktop: creator hover card truncates long identity metadata @desktop', async ({ page }) => {
|
||||
await signUpAndGoToFiles(page)
|
||||
await createFolder(page, 'long-actor-folder')
|
||||
|
||||
@@ -200,6 +200,13 @@ test.describe('File table responsive columns', () => {
|
||||
)
|
||||
})
|
||||
expect(contained).toBe(true)
|
||||
|
||||
for (const value of ['agent-0123456789abcdef0123456789abcdef', actorIssuer]) {
|
||||
const field = card.getByTitle(value)
|
||||
await expect(field).toHaveCSS('white-space', 'nowrap')
|
||||
await expect(field).toHaveCSS('text-overflow', 'ellipsis')
|
||||
expect(await field.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
test('mobile: size and modified columns are hidden @mobile', async ({ page }) => {
|
||||
|
||||
@@ -79,7 +79,7 @@ describe('ActorAvatarHoverCard', () => {
|
||||
expect(profileLink.getAttribute('target')).toBe('_blank')
|
||||
})
|
||||
|
||||
it('wraps long stable identifiers without hiding the full value', async () => {
|
||||
it('truncates long stable identifiers without wrapping the card', async () => {
|
||||
const ref = 'agent-0123456789abcdef0123456789abcdef'
|
||||
render(
|
||||
<ActorAvatarHoverCard
|
||||
@@ -97,7 +97,8 @@ describe('ActorAvatarHoverCard', () => {
|
||||
fireEvent.pointerEnter(screen.getByLabelText('files.createdBy: Research Agent'))
|
||||
|
||||
const visibleRef = await waitFor(() => screen.getByText(ref))
|
||||
expect(visibleRef.className).toContain('break-all')
|
||||
expect(visibleRef.className).toContain('truncate')
|
||||
expect(visibleRef.getAttribute('title')).toBe(ref)
|
||||
})
|
||||
|
||||
it('contains long identity fields within the hover card', async () => {
|
||||
@@ -123,7 +124,8 @@ describe('ActorAvatarHoverCard', () => {
|
||||
expect(card).toBeTruthy()
|
||||
expect(card!.className).toContain('overflow-hidden')
|
||||
expect(screen.getByText(name).className).toContain('break-words')
|
||||
expect(screen.getByText(issuer).className).toContain('break-all')
|
||||
expect(screen.getByText(issuer).className).toContain('truncate')
|
||||
expect(screen.getByText(issuer).getAttribute('title')).toBe(issuer)
|
||||
})
|
||||
|
||||
it('uses a dash when attribution was not recorded', () => {
|
||||
|
||||
@@ -95,7 +95,7 @@ export function ActorAvatarHoverCard({ actor, className }: Pick<ActorIdentityPro
|
||||
{actor.ref && (
|
||||
<div className="grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-4">
|
||||
<dt className="shrink-0 text-muted-foreground">{t('actors.ref')}</dt>
|
||||
<dd className="min-w-0 whitespace-normal break-all text-right font-mono" data-actor-field>
|
||||
<dd className="min-w-0 truncate text-right font-mono" title={actor.ref} data-actor-field>
|
||||
{actor.ref}
|
||||
</dd>
|
||||
</div>
|
||||
@@ -103,7 +103,7 @@ export function ActorAvatarHoverCard({ actor, className }: Pick<ActorIdentityPro
|
||||
{actor.issuer && (
|
||||
<div className="grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-4">
|
||||
<dt className="shrink-0 text-muted-foreground">{t('actors.issuer')}</dt>
|
||||
<dd className="min-w-0 whitespace-normal break-all text-right" data-actor-field>
|
||||
<dd className="min-w-0 truncate text-right" title={actor.issuer} data-actor-field>
|
||||
{actor.issuer}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user