Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.1 KB
Raw Blame
import type { FileEntity } from '../../types'
import { page } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import FileImageItem from '../file-image-item'

const file: FileEntity = {
  id: 'file-1',
  name: 'photo.png',
  size: 4096,
  type: 'image/png',
  progress: 100,
  transferMethod: 'local_file',
  supportFileType: 'image',
  uploadedId: 'uploaded-1',
  base64Url:
    'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jRZkAAAAASUVORK5CYII=',
}

describe('FileImageItem pointer interaction', () => {
  it('keeps the preview clickable when the download action is visible', async () => {
    const screen = await render(<FileImageItem file={file} canPreview showDownloadAction />)
    const preview = screen.getByRole('button', { name: 'common.operation.view photo.png' })
    const download = screen.getByRole('button', { name: 'common.operation.download' })

    await preview.hover()
    await expect.element(download).toBeVisible()
    await preview.click()

    await expect.element(page.getByRole('dialog')).toBeVisible()
  })
})