File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
src/components/Scrollable/tests Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,21 @@ import {ScrollableContext} from '../context';
66import type { ScrollableProps } from '../Scrollable' ;
77
88describe ( '<Scrollable />' , ( ) => {
9+ let rafSpy : jest . SpyInstance ;
10+
11+ beforeAll ( ( ) => {
12+ rafSpy = jest
13+ . spyOn ( window , 'requestAnimationFrame' )
14+ . mockImplementation ( ( cb ) => {
15+ cb ( Date . now ( ) ) ;
16+ return Math . random ( ) ;
17+ } ) ;
18+ } ) ;
19+
20+ afterAll ( ( ) => {
21+ rafSpy . mockRestore ( ) ;
22+ } ) ;
23+
924 it ( 'mounts' , ( ) => {
1025 const scrollable = mountWithApp ( < Scrollable /> ) ;
1126 expect ( scrollable ) . toBeDefined ( ) ;
Original file line number Diff line number Diff line change @@ -6,8 +6,3 @@ import './matchers';
66afterEach ( ( ) => {
77 destroyAll ( ) ;
88} ) ;
9-
10- globalThis . requestAnimationFrame = ( cb ) => {
11- cb ( Date . now ( ) ) ;
12- return Math . random ( ) ;
13- } ;
You can’t perform that action at this time.
0 commit comments