@@ -143,7 +143,7 @@ describe.each([undefined, "static", "filterable"] as const)(
143
143
}
144
144
]
145
145
} )
146
- await user . click ( screen . getByRole ( "checkbox" , { name : "Cats" } ) )
146
+ await user . click ( screen . getByRole ( "checkbox" , { name : "Cats 10 " } ) )
147
147
expect ( spies . onFacetChange ) . toHaveBeenCalledWith ( "topic" , "Cats" , true )
148
148
} )
149
149
@@ -158,10 +158,10 @@ describe.each([undefined, "static", "filterable"] as const)(
158
158
]
159
159
} )
160
160
screen . getByRole ( "checkbox" , {
161
- name : "Civil and Environmental Engineering"
161
+ name : "Civil and Environmental Engineering 100 "
162
162
} )
163
163
screen . getByRole ( "checkbox" , {
164
- name : "Mechanical Engineering"
164
+ name : "Mechanical Engineering 200 "
165
165
} )
166
166
} )
167
167
@@ -180,16 +180,16 @@ describe.each([undefined, "static", "filterable"] as const)(
180
180
} )
181
181
const checkboxCount = ( ) => screen . getAllByRole ( "checkbox" ) . length
182
182
expect ( checkboxCount ( ) ) . toBe ( 3 )
183
- screen . getByRole ( "checkbox" , { name : "Cats" } )
184
- screen . getByRole ( "checkbox" , { name : "Dogs" } )
185
- screen . getByRole ( "checkbox" , { name : "Donkeys" } )
183
+ screen . getByRole ( "checkbox" , { name : "Cats 10 " } )
184
+ screen . getByRole ( "checkbox" , { name : "Dogs 20 " } )
185
+ screen . getByRole ( "checkbox" , { name : "Donkeys 30 " } )
186
186
rerender ( {
187
187
activeFacets : {
188
188
topic : [ "Cats" , "Dragons" ]
189
189
}
190
190
} )
191
191
expect ( checkboxCount ( ) ) . toBe ( 4 )
192
- screen . getByRole ( "checkbox" , { name : "Dragons" } )
192
+ screen . getByRole ( "checkbox" , { name : "Dragons 0 " } )
193
193
} )
194
194
195
195
test ( "Displays filterable facet if type='filterable'" , async ( ) => {
@@ -200,9 +200,9 @@ describe.each([undefined, "static", "filterable"] as const)(
200
200
expect ( screen . getAllByRole ( "checkbox" ) ) . toHaveLength ( 3 )
201
201
invariant ( textbox , "Expected textbox to exist" )
202
202
await user . type ( textbox , "D" )
203
- const box0 = screen . queryByRole ( "checkbox" , { name : "Cats" } )
204
- const box1 = screen . queryByRole ( "checkbox" , { name : "Dogs" } )
205
- const box2 = screen . queryByRole ( "checkbox" , { name : "Donkeys" } )
203
+ const box0 = screen . queryByRole ( "checkbox" , { name : "Cats 10 " } )
204
+ const box1 = screen . queryByRole ( "checkbox" , { name : "Dogs 20 " } )
205
+ const box2 = screen . queryByRole ( "checkbox" , { name : "Donkeys 30 " } )
206
206
expect ( ! ! box0 ) . toBe ( false )
207
207
expect ( ! ! box1 ) . toBe ( true )
208
208
expect ( ! ! box2 ) . toBe ( true )
@@ -242,26 +242,24 @@ describe("FacetDisplay with type='group' facet", () => {
242
242
setup ( )
243
243
const checkboxes = screen . getAllByRole ( "checkbox" )
244
244
const withCerts = screen . getByRole ( "checkbox" , {
245
- name : "With Certificate"
245
+ name : "With Certificate 20 "
246
246
} )
247
- const free = screen . getByRole ( "checkbox" , { name : "Free Stuff" } )
247
+ const free = screen . getByRole ( "checkbox" , { name : "Free Stuff 30 " } )
248
248
expect ( checkboxes ) . toEqual ( [ withCerts , free ] )
249
-
250
- const labels = document . querySelectorAll ( ".facet-label" )
251
- expect ( labels [ 0 ] . textContent ) . toBe ( "With Certificate20" )
252
- expect ( labels [ 1 ] . textContent ) . toBe ( "Free Stuff30" )
253
249
} )
254
250
255
251
test ( "Clicking a checkbox calls onFacetChange" , async ( ) => {
256
252
const { spies } = setup ( )
257
- await user . click ( screen . getByRole ( "checkbox" , { name : "With Certificate" } ) )
253
+ await user . click (
254
+ screen . getByRole ( "checkbox" , { name : "With Certificate 20" } )
255
+ )
258
256
expect ( spies . onFacetChange ) . toHaveBeenCalledWith (
259
257
"certification" ,
260
258
"true" ,
261
259
true
262
260
)
263
261
264
- await user . click ( screen . getByRole ( "checkbox" , { name : "Free Stuff" } ) )
262
+ await user . click ( screen . getByRole ( "checkbox" , { name : "Free Stuff 30 " } ) )
265
263
expect ( spies . onFacetChange ) . toHaveBeenCalledWith ( "free" , "false" , true )
266
264
} )
267
265
@@ -290,7 +288,9 @@ describe("FacetDisplay with type='group' facet", () => {
290
288
certification : true
291
289
}
292
290
} )
293
- const checkbox = screen . getByRole ( "checkbox" , { name : "With Certificate" } )
291
+ const checkbox = screen . getByRole ( "checkbox" , {
292
+ name : "With Certificate 0"
293
+ } )
294
294
expect ( checkbox ) . toBeTruthy ( )
295
295
} )
296
296
} )
0 commit comments