@@ -45,8 +45,8 @@ describe('useSlot', () => {
45
45
className ?: string ;
46
46
component ?: React . ElementType ;
47
47
href ?: string ;
48
- components ?: { root ?: React . ElementType ; decorator ?: React . ElementType } ;
49
- componentsProps ?: {
48
+ slots ?: { root ?: React . ElementType ; decorator ?: React . ElementType } ;
49
+ slotProps ?: {
50
50
root ?: SlotComponentProps < 'button' , Record < string , any > , { } > ;
51
51
decorator ?: SlotComponentProps < 'span' , { size ?: 'sm' | 'md' } & Record < string , any > , { } > ;
52
52
} ;
@@ -92,7 +92,7 @@ describe('useSlot', () => {
92
92
93
93
it ( 'should append classes' , ( ) => {
94
94
const { getByRole } = render (
95
- < Item className = "foo-bar" componentsProps = { { decorator : { className : 'foo-bar' } } } /> ,
95
+ < Item className = "foo-bar" slotProps = { { decorator : { className : 'foo-bar' } } } /> ,
96
96
) ;
97
97
expect ( getByRole ( 'button' ) ) . to . have . class ( 'root' ) ;
98
98
expect ( getByRole ( 'button' ) ) . to . have . class ( 'foo-bar' ) ;
@@ -106,13 +106,13 @@ describe('useSlot', () => {
106
106
} ) ;
107
107
108
108
it ( 'slot ownerstate should be overriable' , ( ) => {
109
- const { getByRole } = render ( < Item componentsProps = { { decorator : { size : 'sm' } } } /> ) ;
109
+ const { getByRole } = render ( < Item slotProps = { { decorator : { size : 'sm' } } } /> ) ;
110
110
expect ( getByRole ( 'button' ) . firstChild ) . to . have . class ( 'size-sm' ) ;
111
111
} ) ;
112
112
113
- it ( 'componentsProps has higher priority' , ( ) => {
113
+ it ( 'slotProps has higher priority' , ( ) => {
114
114
const { getByRole } = render (
115
- < Item data-item = "foo" componentsProps = { { root : { 'data-item' : 'bar' } } } /> ,
115
+ < Item data-item = "foo" slotProps = { { root : { 'data-item' : 'bar' } } } /> ,
116
116
) ;
117
117
expect ( getByRole ( 'button' ) ) . to . have . attribute ( 'data-item' , 'bar' ) ;
118
118
} ) ;
@@ -122,15 +122,15 @@ describe('useSlot', () => {
122
122
expect ( getByRole ( 'link' ) ) . toBeVisible ( ) ;
123
123
} ) ;
124
124
125
- it ( 'use componentsProps `component` over `component` prop' , ( ) => {
125
+ it ( 'use slotProps `component` over `component` prop' , ( ) => {
126
126
const { getByRole } = render (
127
- < Item component = "div" componentsProps = { { root : { component : 'a' , href : '/' } } } /> ,
127
+ < Item component = "div" slotProps = { { root : { component : 'a' , href : '/' } } } /> ,
128
128
) ;
129
129
expect ( getByRole ( 'link' ) ) . toBeVisible ( ) ;
130
130
} ) ;
131
131
132
132
it ( 'can change decorator leaf component' , ( ) => {
133
- const { getByRole } = render ( < Item componentsProps = { { decorator : { component : 'div' } } } /> ) ;
133
+ const { getByRole } = render ( < Item slotProps = { { decorator : { component : 'div' } } } /> ) ;
134
134
expect ( getByRole ( 'button' ) . firstChild ) . to . have . tagName ( 'div' ) ;
135
135
} ) ;
136
136
} ) ;
@@ -144,12 +144,12 @@ describe('useSlot', () => {
144
144
145
145
const Item = ( props : {
146
146
component ?: React . ElementType ;
147
- components ?: {
147
+ slots ?: {
148
148
root ?: React . ElementType ;
149
149
listbox ?: React . ElementType ;
150
150
option ?: React . ElementType ;
151
151
} ;
152
- componentsProps ?: {
152
+ slotProps ?: {
153
153
root ?: SlotComponentProps < 'button' , Record < string , any > , { } > ;
154
154
listbox ?: SlotComponentProps < 'span' , Record < string , any > , { } > ;
155
155
option ?: SlotComponentProps < 'div' , Record < string , any > , { } > ;
@@ -208,19 +208,19 @@ describe('useSlot', () => {
208
208
const Listbox = ( { component } : { component ?: React . ElementType } ) => (
209
209
< ul data-component = { component } />
210
210
) ;
211
- const { getByRole } = render ( < Item components = { { listbox : Listbox } } /> ) ;
211
+ const { getByRole } = render ( < Item slots = { { listbox : Listbox } } /> ) ;
212
212
expect ( getByRole ( 'list' ) ) . toBeVisible ( ) ;
213
213
expect ( getByRole ( 'list' ) ) . not . to . have . attribute ( 'class' ) ;
214
214
expect ( getByRole ( 'list' ) ) . not . to . have . attribute ( 'data-component' ) ;
215
215
} ) ;
216
216
217
217
it ( 'the listbox leaf component can be changed' , ( ) => {
218
- const { getByRole } = render ( < Item componentsProps = { { listbox : { component : 'div' } } } /> ) ;
218
+ const { getByRole } = render ( < Item slotProps = { { listbox : { component : 'div' } } } /> ) ;
219
219
expect ( getByRole ( 'menu' ) ) . to . have . tagName ( 'div' ) ;
220
220
} ) ;
221
221
222
222
it ( 'the option leaf component can be changed' , ( ) => {
223
- const { getByRole } = render ( < Item componentsProps = { { option : { component : 'div' } } } /> ) ;
223
+ const { getByRole } = render ( < Item slotProps = { { option : { component : 'div' } } } /> ) ;
224
224
expect ( getByRole ( 'menuitem' ) ) . to . have . tagName ( 'div' ) ;
225
225
} ) ;
226
226
} ) ;
0 commit comments