|
1 | 1 | import React, {useEffect, useRef} from 'react'; |
| 2 | +import type {Element as ElementType} from '@shopify/react-testing'; |
2 | 3 | import { |
3 | 4 | CirclePlusMinor, |
4 | 5 | CircleTickMajor, |
@@ -262,32 +263,32 @@ describe('<Banner />', () => { |
262 | 263 | it('adds a keyFocused class to the banner on keyUp', () => { |
263 | 264 | const banner = mountWithApp(<Banner />); |
264 | 265 |
|
265 | | - const bannerDiv = banner.find('div', { |
266 | | - className: 'Banner withinPage', |
267 | | - }); |
| 266 | + const bannerDiv = banner.findWhere((el: any) => |
| 267 | + el.prop('className')?.includes('Banner withinPage'), |
| 268 | + ) as ElementType<any>; |
268 | 269 |
|
269 | 270 | bannerDiv!.trigger('onKeyUp', { |
270 | 271 | target: bannerDiv!.domNode as HTMLDivElement, |
271 | 272 | }); |
272 | 273 |
|
273 | 274 | expect(banner).toContainReactComponent('div', { |
274 | | - className: 'Banner keyFocused withinPage', |
| 275 | + className: expect.stringContaining('Banner keyFocused withinPage'), |
275 | 276 | }); |
276 | 277 | }); |
277 | 278 |
|
278 | 279 | it('does not add a keyFocused class onMouseUp', () => { |
279 | 280 | const banner = mountWithApp(<Banner />); |
280 | 281 |
|
281 | | - const bannerDiv = banner.find('div', { |
282 | | - className: 'Banner withinPage', |
283 | | - }); |
| 282 | + const bannerDiv = banner.findWhere((el: any) => |
| 283 | + el.prop('className')?.includes('Banner withinPage'), |
| 284 | + ) as ElementType<any>; |
284 | 285 |
|
285 | 286 | bannerDiv!.trigger('onMouseUp', { |
286 | 287 | currentTarget: bannerDiv!.domNode as HTMLDivElement, |
287 | 288 | }); |
288 | 289 |
|
289 | 290 | expect(banner).toContainReactComponent('div', { |
290 | | - className: 'Banner withinPage', |
| 291 | + className: expect.stringContaining('Banner withinPage'), |
291 | 292 | }); |
292 | 293 | }); |
293 | 294 | }); |
|
0 commit comments