({
boxShadow: t.shadows?.small,
'&:hover': {
boxShadow: t.shadows?.[2],
},
})}
/>
)
expect(json).toHaveStyleRule('box-shadow', '0 0 4px rgba(0, 0, 0, .125)')
})
test('accepts css prop', () => {
const expectSnippet = expecter(
`/** @jsxImportSource ./packages/core */
export {}`,
{ jsx: false }
)
expectSnippet(`const _1 =
`).toSucceed()
// TODO: uncomment this some day
// // Theme UI theme can be injected to @emotion/react module in userspace
// expectSnippet(
// `
// import { Theme as ThemeUITheme } from './packages/css'
// declare module '@emotion/react' {
// export interface Theme extends ThemeUITheme {}
// }
//
{
// const _t = t;
// return {}
// }}
// />`
// ).toInfer('_t', 'Theme')
expectSnippet(
`import { css } from '@emotion/react'
const TestComponent = () =>
`
).toSucceed()
})
})
{
type HasSxProp
= T extends SxProp ? true : false
type DoesNotHaveSxProp = NotHas
type _ =
| Assert<
DoesNotHaveSxProp<
ThemeUIJSX.LibraryManagedAttributes<
React.FC,
{ className?: undefined }
>
>,
true
>
| Assert<
| HasSxProp<
ThemeUIJSX.LibraryManagedAttributes<
React.FC,
{ className?: string; anotherProp: string; andOneMore: number }
>
>
| HasSxProp<
ThemeUIJSX.LibraryManagedAttributes
>
// if `className` can be whatever, we have `sx` prop
| HasSxProp<
ThemeUIJSX.LibraryManagedAttributes<
React.FC,
{ className?: unknown }
>
>
// if `className` can be string or many, we have `sx` prop
| HasSxProp<
ThemeUIJSX.LibraryManagedAttributes<
React.FC,
{
className?: string | string[]
}
>
>,
true
>
}