Skip to content

Commit fbee1fc

Browse files
authored
Update to use existing tests
1 parent 1fceb45 commit fbee1fc

File tree

2 files changed

+6
-62
lines changed

2 files changed

+6
-62
lines changed

src/__tests__/utils/create-slots.test.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/__tests__/utils/createSlots.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import createSlots from '../../utils/create-slots'
55

66
// setup a component with slots
77
const {Slots, Slot} = createSlots(['One', 'Two', 'Three'])
8-
type ContextTypes = {salutation?: string}
8+
type Props = {context?: {salutation: string}}
99

10-
const ComponentWithSlots: React.FC<React.PropsWithChildren<ContextTypes>> = ({salutation, children}) => {
10+
const ComponentWithSlots: React.FC<React.PropsWithChildren<Props>> = ({context, children}) => {
1111
return (
12-
<Slots context={{salutation}}>
12+
<Slots context={context}>
1313
{slots => (
1414
<div>
1515
{slots.One}
@@ -25,9 +25,9 @@ const SlotItem1: React.FC<React.PropsWithChildren<unknown>> = ({children}) => <S
2525
const SlotItem2: React.FC<React.PropsWithChildren<unknown>> = ({children}) => <Slot name="Two">{children}</Slot>
2626
const SlotItem3: React.FC<React.PropsWithChildren<unknown>> = ({children}) => (
2727
<Slot name="Three">
28-
{(context: ContextTypes) => (
28+
{(context: Props['context']) => (
2929
<>
30-
{context.salutation} {children}
30+
{context?.salutation} {children}
3131
</>
3232
)}
3333
</Slot>
@@ -64,7 +64,7 @@ describe('ComponentWithSlots', () => {
6464

6565
it('renders with context passed to children', async () => {
6666
const component = render(
67-
<ComponentWithSlots salutation="hi">
67+
<ComponentWithSlots context={{salutation: 'hi'}}>
6868
<SlotItem3>third</SlotItem3>
6969
free form
7070
</ComponentWithSlots>

0 commit comments

Comments
 (0)