Merge remote-tracking branch 'origin/main' into feat/model-plugins-implementing

This commit is contained in:
yyh
2026-03-12 14:46:16 +08:00
220 changed files with 39303 additions and 1025 deletions

View File

@ -117,9 +117,8 @@ describe('Operations', () => {
it('should render disabled switch when embeddingAvailable is false in list scene', () => {
render(<Operations {...defaultProps} embeddingAvailable={false} scene="list" />)
// Switch component uses opacity-50 class when disabled
const disabledSwitch = document.querySelector('.\\!opacity-50')
expect(disabledSwitch).toBeInTheDocument()
const disabledSwitch = screen.getByRole('switch')
expect(disabledSwitch).toHaveAttribute('aria-disabled', 'true')
})
})

View File

@ -206,7 +206,7 @@ describe('SegmentCard', () => {
)
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveClass('!cursor-not-allowed')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
it('should show action buttons when embeddingAvailable is true', () => {
@ -792,9 +792,8 @@ describe('SegmentCard', () => {
/>,
)
// The Switch component uses CSS classes for disabled state, not the native disabled attribute
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveClass('!cursor-not-allowed', '!opacity-50')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
it('should handle zero word count', () => {
@ -877,7 +876,7 @@ describe('SegmentCard', () => {
)
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveClass('bg-components-toggle-bg')
expect(switchElement).toHaveAttribute('aria-checked', 'true')
})
it('should render real Switch component with unchecked state', () => {
@ -893,7 +892,7 @@ describe('SegmentCard', () => {
)
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveClass('bg-components-toggle-bg-unchecked')
expect(switchElement).toHaveAttribute('aria-checked', 'false')
})
it('should render real SegmentIndexTag with position formatting', () => {

View File

@ -169,9 +169,8 @@ describe('StatusItem', () => {
datasetId="dataset-1"
/>,
)
const switchElement = document.querySelector('[role="switch"]')
// Switch component uses opacity-50 and cursor-not-allowed when disabled
expect(switchElement).toHaveClass('!opacity-50')
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
it('should render switch as disabled when embedding (queuing status)', () => {
@ -187,9 +186,8 @@ describe('StatusItem', () => {
datasetId="dataset-1"
/>,
)
const switchElement = document.querySelector('[role="switch"]')
// Switch component uses opacity-50 and cursor-not-allowed when disabled
expect(switchElement).toHaveClass('!opacity-50')
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
it('should render switch as disabled when embedding (indexing status)', () => {
@ -205,9 +203,8 @@ describe('StatusItem', () => {
datasetId="dataset-1"
/>,
)
const switchElement = document.querySelector('[role="switch"]')
// Switch component uses opacity-50 and cursor-not-allowed when disabled
expect(switchElement).toHaveClass('!opacity-50')
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
it('should render switch as disabled when embedding (paused status)', () => {
@ -223,9 +220,8 @@ describe('StatusItem', () => {
datasetId="dataset-1"
/>,
)
const switchElement = document.querySelector('[role="switch"]')
// Switch component uses opacity-50 and cursor-not-allowed when disabled
expect(switchElement).toHaveClass('!opacity-50')
const switchElement = screen.getByRole('switch')
expect(switchElement).toHaveAttribute('aria-disabled', 'true')
})
})