@@ -368,11 +368,9 @@ describe('rc-tooltip', () => {
368
368
const tooltipArrowElement = container . querySelector ( '.rc-tooltip-arrow' ) as HTMLElement ;
369
369
370
370
// Verify styles
371
- expect ( tooltipElement . style . backgroundColor ) . toBe ( 'blue' ) ;
372
- expect ( tooltipElement . style . zIndex ) . toBe ( '1000' ) ;
373
- expect ( tooltipBodyElement . style . color ) . toBe ( 'red' ) ;
374
- expect ( tooltipBodyElement . style . fontSize ) . toBe ( '14px' ) ;
375
- expect ( tooltipArrowElement . style . borderColor ) . toBe ( 'green' ) ;
371
+ expect ( tooltipElement ) . toHaveStyle ( { backgroundColor : 'blue' , zIndex : '1000' } ) ;
372
+ expect ( tooltipBodyElement ) . toHaveStyle ( { color : 'red' , fontSize : '14px' } ) ;
373
+ expect ( tooltipArrowElement ) . toHaveStyle ( { borderColor : 'green' } ) ;
376
374
} ) ;
377
375
378
376
it ( 'should apply both classNames and styles simultaneously' , ( ) => {
@@ -406,11 +404,11 @@ describe('rc-tooltip', () => {
406
404
407
405
// Verify that classNames and styles work simultaneously
408
406
expect ( tooltipElement ) . toHaveClass ( 'custom-root' ) ;
409
- expect ( tooltipElement . style . backgroundColor ) . toBe ( 'blue' ) ;
407
+ expect ( tooltipElement ) . toHaveStyle ( { backgroundColor : 'blue' } ) ;
410
408
expect ( tooltipBodyElement ) . toHaveClass ( 'custom-body' ) ;
411
- expect ( tooltipBodyElement . style . color ) . toBe ( 'red' ) ;
409
+ expect ( tooltipBodyElement ) . toHaveStyle ( { color : 'red' } ) ;
412
410
expect ( tooltipArrowElement ) . toHaveClass ( 'custom-arrow' ) ;
413
- expect ( tooltipArrowElement . style . borderColor ) . toBe ( 'green' ) ;
411
+ expect ( tooltipArrowElement ) . toHaveStyle ( { borderColor : 'green' } ) ;
414
412
} ) ;
415
413
416
414
it ( 'should work with partial classNames and styles' , ( ) => {
@@ -439,7 +437,7 @@ describe('rc-tooltip', () => {
439
437
const tooltipArrowElement = container . querySelector ( '.rc-tooltip-arrow' ) as HTMLElement ;
440
438
441
439
// Verify partial configuration takes effect
442
- expect ( tooltipElement . style . backgroundColor ) . toBe ( 'blue' ) ;
440
+ expect ( tooltipElement ) . toHaveStyle ( { backgroundColor : 'blue' } ) ;
443
441
expect ( tooltipBodyElement ) . toHaveClass ( 'custom-body' ) ;
444
442
445
443
// Verify that unconfigured elements don't have custom class names or styles
@@ -481,9 +479,9 @@ describe('rc-tooltip', () => {
481
479
482
480
// Other styles still take effect
483
481
expect ( tooltipElement ) . toHaveClass ( 'custom-root' ) ;
484
- expect ( tooltipElement . style . backgroundColor ) . toBe ( 'blue' ) ;
482
+ expect ( tooltipElement ) . toHaveStyle ( { backgroundColor : 'blue' } ) ;
485
483
expect ( tooltipBodyElement ) . toHaveClass ( 'custom-body' ) ;
486
- expect ( tooltipBodyElement . style . color ) . toBe ( 'red' ) ;
484
+ expect ( tooltipBodyElement ) . toHaveStyle ( { color : 'red' } ) ;
487
485
} ) ;
488
486
} ) ;
489
487
0 commit comments