mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
refactor(switch): Base UI migration with loading/skeleton variants (#33345)
Signed-off-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -674,9 +674,7 @@ describe('ApiAccessCard', () => {
|
||||
)
|
||||
|
||||
const switchButton = screen.getByRole('switch')
|
||||
// Headless UI Switch uses CSS classes for disabled state
|
||||
expect(switchButton).toHaveClass('!cursor-not-allowed')
|
||||
expect(switchButton).toHaveClass('!opacity-50')
|
||||
expect(switchButton).toHaveAttribute('aria-disabled', 'true')
|
||||
})
|
||||
|
||||
it('should enable switch when user is workspace manager', () => {
|
||||
@ -689,8 +687,7 @@ describe('ApiAccessCard', () => {
|
||||
)
|
||||
|
||||
const switchButton = screen.getByRole('switch')
|
||||
expect(switchButton).not.toHaveClass('!cursor-not-allowed')
|
||||
expect(switchButton).not.toHaveClass('!opacity-50')
|
||||
expect(switchButton).not.toHaveAttribute('aria-disabled', 'true')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -155,8 +155,7 @@ describe('Card (API Access)', () => {
|
||||
|
||||
const switchButton = screen.getByRole('switch')
|
||||
expect(switchButton).toHaveAttribute('aria-checked', 'true')
|
||||
// Headless UI Switch uses CSS classes for disabled state, not the disabled attribute
|
||||
expect(switchButton).toHaveClass('!cursor-not-allowed', '!opacity-50')
|
||||
expect(switchButton).toHaveAttribute('aria-disabled', 'true')
|
||||
})
|
||||
|
||||
it('should enable switch when user is workspace manager', () => {
|
||||
@ -164,7 +163,7 @@ describe('Card (API Access)', () => {
|
||||
render(<Card apiEnabled={true} />)
|
||||
|
||||
const switchButton = screen.getByRole('switch')
|
||||
expect(switchButton).not.toBeDisabled()
|
||||
expect(switchButton).not.toHaveAttribute('aria-disabled', 'true')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user