mirror of
https://github.com/status-im/react-native.git
synced 2025-02-03 13:14:42 +00:00
Add request/cancelAnimationFrame to jest setup
Reviewed By: cpojer Differential Revision: D5005587 fbshipit-source-id: 653c281df9025a75ed8eecd22a2e64eaf188bf3e
This commit is contained in:
parent
909fb7239d
commit
8ae4c3fcfd
@ -111,11 +111,6 @@ describe('Animated tests', () => {
|
||||
|
||||
|
||||
it('stops animation when detached', () => {
|
||||
// jest environment doesn't have cancelAnimationFrame :(
|
||||
if (!global.cancelAnimationFrame) {
|
||||
global.cancelAnimationFrame = jest.fn();
|
||||
}
|
||||
|
||||
var anim = new Animated.Value(0);
|
||||
var callback = jest.fn();
|
||||
|
||||
|
@ -55,11 +55,6 @@ describe('Native Animated', () => {
|
||||
nativeAnimatedModule.startListeningToAnimatedNodeValue = jest.fn();
|
||||
nativeAnimatedModule.stopAnimation = jest.fn();
|
||||
nativeAnimatedModule.stopListeningToAnimatedNodeValue = jest.fn();
|
||||
|
||||
// jest environment doesn't have cancelAnimationFrame :(
|
||||
if (!global.cancelAnimationFrame) {
|
||||
global.cancelAnimationFrame = jest.fn();
|
||||
}
|
||||
});
|
||||
|
||||
describe('Animated Value', () => {
|
||||
|
@ -19,6 +19,13 @@ global.__DEV__ = true;
|
||||
global.Promise = require.requireActual('promise');
|
||||
global.regeneratorRuntime = require.requireActual('regenerator-runtime/runtime');
|
||||
|
||||
global.requestAnimationFrame = function(callback) {
|
||||
setTimeout(callback, 0);
|
||||
};
|
||||
global.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
|
||||
jest
|
||||
.mock('setupDevtools')
|
||||
.mock('npmlog');
|
||||
|
Loading…
x
Reference in New Issue
Block a user