test: improve coverage for header components (#32628)

This commit is contained in:
Poojan
2026-02-27 07:57:46 +05:30
committed by GitHub
parent 349d2d8e4e
commit 5b45b62994
21 changed files with 2145 additions and 346 deletions

View File

@ -4,11 +4,12 @@ import * as React from 'react'
import { cn } from '@/utils/classnames'
type SwitchProps = {
value: boolean
onChange?: (value: boolean) => void
size?: 'xs' | 'sm' | 'md' | 'lg' | 'l'
disabled?: boolean
className?: string
'value': boolean
'onChange'?: (value: boolean) => void
'size'?: 'xs' | 'sm' | 'md' | 'lg' | 'l'
'disabled'?: boolean
'className'?: string
'data-testid'?: string
}
const Switch = (
@ -19,6 +20,7 @@ const Switch = (
size = 'md',
disabled = false,
className,
'data-testid': dataTestid,
}: SwitchProps & {
ref?: React.RefObject<HTMLButtonElement>
},
@ -56,6 +58,7 @@ const Switch = (
onChange?.(checked)
}}
className={cn(wrapStyle[size], value ? 'bg-components-toggle-bg' : 'bg-components-toggle-bg-unchecked', 'relative inline-flex shrink-0 cursor-pointer rounded-[5px] border-2 border-transparent transition-colors duration-200 ease-in-out', disabled ? '!cursor-not-allowed !opacity-50' : '', size === 'xs' && 'rounded-sm', className)}
data-testid={dataTestid}
>
<span
aria-hidden="true"