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:
yyh
2026-03-12 14:40:43 +08:00
committed by GitHub
parent b44b37518a
commit c43307dae1
21 changed files with 518 additions and 624 deletions

View File

@ -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')
})
})

View File

@ -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')
})
})