@@ -359,10 +359,11 @@ export default () => {
359
359
} ;
360
360
const node = createHTMLElement ( "div" ) ;
361
361
const modal = ReactDOM . render ( < Modal { ...props } /> , node ) ;
362
- requestAnimationFrame ( ( ) => {
362
+ const request = requestAnimationFrame ( ( ) => {
363
363
mcontent ( modal ) . className . should . be . eql ( "myClass myClass_after-open" ) ;
364
364
ReactDOM . unmountComponentAtNode ( node ) ;
365
365
} ) ;
366
+ cancelAnimationFrame ( request ) ;
366
367
} ) ;
367
368
} ) ;
368
369
@@ -378,12 +379,13 @@ export default () => {
378
379
} ;
379
380
const node = createHTMLElement ( "div" ) ;
380
381
const modal = ReactDOM . render ( < Modal { ...props } /> , node ) ;
381
- requestAnimationFrame ( ( ) => {
382
+ const request = requestAnimationFrame ( ( ) => {
382
383
moverlay ( modal ) . className . should . be . eql (
383
384
"myOverlayClass myOverlayClass_after-open"
384
385
) ;
385
386
ReactDOM . unmountComponentAtNode ( node ) ;
386
387
} ) ;
388
+ cancelAnimationFrame ( request ) ;
387
389
} ) ;
388
390
} ) ;
389
391
@@ -562,7 +564,10 @@ export default () => {
562
564
ReactDOM . render ( < Modal isOpen appElement = { el } /> , node ) ;
563
565
el . getAttribute ( "aria-hidden" ) . should . be . eql ( "true" ) ;
564
566
ReactDOM . unmountComponentAtNode ( node ) ;
565
- should ( el . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
567
+ const request = requestAnimationFrame ( ( ) => {
568
+ should ( el . getAttribute ( 'aria-hidden' ) ) . not . be . ok ( ) ;
569
+ } ) ;
570
+ cancelAnimationFrame ( request ) ;
566
571
} ) ;
567
572
} ) ;
568
573
@@ -593,10 +598,13 @@ export default () => {
593
598
</ div >
594
599
) ;
595
600
596
- ReactDOM . render ( updatedState , rootNode ) ;
597
- should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
601
+ const request = requestAnimationFrame ( ( ) => {
602
+ ReactDOM . render ( updatedState , rootNode ) ;
603
+ should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
598
604
599
- ReactDOM . unmountComponentAtNode ( rootNode ) ;
605
+ ReactDOM . unmountComponentAtNode ( rootNode ) ;
606
+ } ) ;
607
+ cancelAnimationFrame ( request ) ;
600
608
} ) ;
601
609
} ) ;
602
610
@@ -652,7 +660,10 @@ export default () => {
652
660
appElement . getAttribute ( "aria-hidden" ) . should . be . eql ( "true" ) ;
653
661
} ) ;
654
662
655
- should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
663
+ const request = requestAnimationFrame ( ( ) => {
664
+ should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
665
+ } ) ;
666
+ cancelAnimationFrame ( request ) ;
656
667
} ) ;
657
668
} ) ;
658
669
@@ -673,7 +684,11 @@ export default () => {
673
684
} ) ;
674
685
check ( "true" ) ;
675
686
} ) ;
676
- should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
687
+
688
+ const request = requestAnimationFrame ( ( ) => {
689
+ should ( appElement . getAttribute ( "aria-hidden" ) ) . not . be . ok ( ) ;
690
+ } ) ;
691
+ cancelAnimationFrame ( request ) ;
677
692
} ) ;
678
693
} ) ;
679
694
@@ -683,13 +698,14 @@ export default () => {
683
698
const props = { isOpen : true } ;
684
699
const node = createHTMLElement ( "div" ) ;
685
700
const modal = ReactDOM . render ( < Modal { ...props } /> , node ) ;
686
- requestAnimationFrame ( ( ) => {
701
+ const request = requestAnimationFrame ( ( ) => {
687
702
const contentName = modal . portal . content . className ;
688
703
const overlayName = modal . portal . overlay . className ;
689
704
rg . test ( contentName ) . should . be . ok ( ) ;
690
705
rg . test ( overlayName ) . should . be . ok ( ) ;
691
706
ReactDOM . unmountComponentAtNode ( node ) ;
692
707
} ) ;
708
+ cancelAnimationFrame ( request ) ;
693
709
} ) ;
694
710
} ) ;
695
711
0 commit comments