mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
Merge remote-tracking branch 'origin/main' into feat/support-agent-sandbox
# Conflicts: # api/uv.lock # web/app/components/apps/__tests__/app-card.spec.tsx # web/app/components/apps/__tests__/list.spec.tsx # web/app/components/datasets/create/__tests__/index.spec.tsx # web/app/components/datasets/metadata/metadata-dataset/__tests__/dataset-metadata-drawer.spec.tsx # web/app/components/plugins/readme-panel/__tests__/index.spec.tsx # web/app/components/rag-pipeline/__tests__/index.spec.tsx # web/app/components/rag-pipeline/hooks/__tests__/index.spec.ts # web/eslint-suppressions.json
This commit is contained in:
33
web/app/components/base/list-empty/horizontal-line.spec.tsx
Normal file
33
web/app/components/base/list-empty/horizontal-line.spec.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { render } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import HorizontalLine from './horizontal-line'
|
||||
|
||||
describe('HorizontalLine', () => {
|
||||
describe('Render', () => {
|
||||
it('renders correctly', () => {
|
||||
const { container } = render(<HorizontalLine />)
|
||||
const svg = container.querySelector('svg')
|
||||
expect(svg).toBeInTheDocument()
|
||||
expect(svg).toHaveAttribute('width', '240')
|
||||
expect(svg).toHaveAttribute('height', '2')
|
||||
})
|
||||
|
||||
it('renders linear gradient definition', () => {
|
||||
const { container } = render(<HorizontalLine />)
|
||||
const defs = container.querySelector('defs')
|
||||
const linearGradient = container.querySelector('linearGradient')
|
||||
expect(defs).toBeInTheDocument()
|
||||
expect(linearGradient).toBeInTheDocument()
|
||||
expect(linearGradient).toHaveAttribute('id', 'paint0_linear_8619_59125')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Style', () => {
|
||||
it('applies custom className', () => {
|
||||
const testClass = 'custom-test-class'
|
||||
const { container } = render(<HorizontalLine className={testClass} />)
|
||||
const svg = container.querySelector('svg')
|
||||
expect(svg).toHaveClass(testClass)
|
||||
})
|
||||
})
|
||||
})
|
||||
37
web/app/components/base/list-empty/index.spec.tsx
Normal file
37
web/app/components/base/list-empty/index.spec.tsx
Normal file
@ -0,0 +1,37 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import ListEmpty from './index'
|
||||
|
||||
describe('ListEmpty Component', () => {
|
||||
describe('Render', () => {
|
||||
it('renders default icon when no icon is provided', () => {
|
||||
const { container } = render(<ListEmpty />)
|
||||
expect(container.querySelector('[data-icon="Variable02"]')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders custom icon when provided', () => {
|
||||
const { container } = render(<ListEmpty icon={<div data-testid="custom-icon" />} />)
|
||||
expect(container.querySelector('[data-icon="Variable02"]')).not.toBeInTheDocument()
|
||||
expect(screen.getByTestId('custom-icon')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders design lines', () => {
|
||||
const { container } = render(<ListEmpty />)
|
||||
const svgs = container.querySelectorAll('svg')
|
||||
expect(svgs).toHaveLength(5)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Props', () => {
|
||||
it('renders title and description correctly', () => {
|
||||
const testTitle = 'Empty List'
|
||||
const testDescription = <span data-testid="desc">No items found</span>
|
||||
|
||||
render(<ListEmpty title={testTitle} description={testDescription} />)
|
||||
|
||||
expect(screen.getByText(testTitle)).toBeInTheDocument()
|
||||
expect(screen.getByTestId('desc')).toBeInTheDocument()
|
||||
expect(screen.getByText('No items found')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
})
|
||||
33
web/app/components/base/list-empty/vertical-line.spec.tsx
Normal file
33
web/app/components/base/list-empty/vertical-line.spec.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { render } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import VerticalLine from './vertical-line'
|
||||
|
||||
describe('VerticalLine', () => {
|
||||
describe('Render', () => {
|
||||
it('renders correctly', () => {
|
||||
const { container } = render(<VerticalLine />)
|
||||
const svg = container.querySelector('svg')
|
||||
expect(svg).toBeInTheDocument()
|
||||
expect(svg).toHaveAttribute('width', '2')
|
||||
expect(svg).toHaveAttribute('height', '132')
|
||||
})
|
||||
|
||||
it('renders linear gradient definition', () => {
|
||||
const { container } = render(<VerticalLine />)
|
||||
const defs = container.querySelector('defs')
|
||||
const linearGradient = container.querySelector('linearGradient')
|
||||
expect(defs).toBeInTheDocument()
|
||||
expect(linearGradient).toBeInTheDocument()
|
||||
expect(linearGradient).toHaveAttribute('id', 'paint0_linear_8619_59128')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Style', () => {
|
||||
it('applies custom className', () => {
|
||||
const testClass = 'custom-test-class'
|
||||
const { container } = render(<VerticalLine className={testClass} />)
|
||||
const svg = container.querySelector('svg')
|
||||
expect(svg).toHaveClass(testClass)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user