Files
deepseek-harness/packages/client/ui-attachment/tests/drop-overlay.client.spec.tsx
creatixchu 2c9036b102 feat(web): whole-page image drop, projected intake limits, and thumbnail tiling
Second alignment step for #2248: document-level drag intake behind the new
DropOverlay atom, lightbox close icon and shared dialog mask, DeepSeek Chat
thumbnail rules (single 240px long edge with ratio clamp, 64px tiles, merged
consecutive assistant images), image limits raised to 20/10MiB/100MiB and
published to clients as the imageLimits projection, whole-batch intake
pre-check with product-copy banners, and attachment-error reasons mapped to
localized copy.
2026-08-12 12:31:52 +08:00

39 lines
1.6 KiB
TypeScript

// @vitest-environment jsdom
import { afterEach, describe, expect, it } from 'vitest'
import { cleanup, render } from '@testing-library/react'
import { DropOverlay } from '../src/DropOverlay.tsx'
afterEach(cleanup)
describe('DropOverlay', () => {
it('portals the invitation with its title and limits desc to the body', () => {
const view = render(
<DropOverlay disabled={false} labels={{ title: '图片拖动到此处即可添加', desc: '最多 20 张,每张 10MB' }} />,
)
const overlay = view.getByRole('status')
expect(overlay.parentElement).toBe(document.body)
expect(overlay.textContent).toContain('图片拖动到此处即可添加')
expect(overlay.textContent).toContain('最多 20 张,每张 10MB')
})
it('omits the desc line when none is resolved', () => {
const view = render(<DropOverlay disabled={false} labels={{ title: '图片拖动到此处即可添加' }} />)
expect(view.getByRole('status').textContent).toBe('图片拖动到此处即可添加')
})
it('drops the desc and switches the illustration while disabled', () => {
const enabled = render(
<DropOverlay disabled={false} labels={{ title: '拖入', desc: '限制' }} />,
)
const enabledSvg = enabled.getByRole('status').querySelector('svg')!.innerHTML
enabled.unmount()
const disabled = render(
<DropOverlay disabled labels={{ title: '当前无法添加图片', desc: '限制' }} />,
)
const overlay = disabled.getByRole('status')
expect(overlay.textContent).toBe('当前无法添加图片')
expect(overlay.querySelector('svg')!.innerHTML).not.toBe(enabledSvg)
})
})