Skip to content

Commit

Permalink
feat(a11y): update type tests after review
Browse files Browse the repository at this point in the history
  • Loading branch information
lismith2-cisco committed Dec 18, 2024
1 parent 5e0ad16 commit a6243db
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/Popover/Popover.typetest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,25 @@ import { ExpectExtends, Expect, ExpectFalse } from '../../utils/typetest.util';
// NOTE: STATIC TYPE TESTS RUN ON LINT
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type cases = [
// if there is a close button, there must be a closeButtonProps aria-label
// closeButtonProps must always contain aria-label
// if there is no close button, closeButtonProps is optional
Expect<ExpectExtends<PopoverCloseButtonProps, Record<string, never>>>,
Expect<ExpectExtends<PopoverCloseButtonProps, { closeButtonPlacement: 'none' }>>,
Expect<
ExpectExtends<
PopoverCloseButtonProps,
{ closeButtonPlacement: 'none'; closeButtonProps: { 'aria-label': 'abc' } }
>
>,
ExpectFalse<
ExpectExtends<
PopoverCloseButtonProps,
{ closeButtonPlacement: 'none'; closeButtonProps: Record<string, never> }
>
>,

// closeButtonProps must always contain aria-label
// if there is a close button, closeButtonProps is required
ExpectFalse<ExpectExtends<PopoverCloseButtonProps, { closeButtonPlacement: 'top-left' }>>,
ExpectFalse<ExpectExtends<PopoverCloseButtonProps, { closeButtonPlacement: 'top-right' }>>,
ExpectFalse<
Expand Down

0 comments on commit a6243db

Please sign in to comment.