[RN] Fix Animated tests
This commit is contained in:
parent
5de0796126
commit
5f91d404e1
|
@ -37,7 +37,7 @@ describe('Animated', () => {
|
||||||
}
|
}
|
||||||
}, callback);
|
}, callback);
|
||||||
|
|
||||||
expect(anim.getChildren().length).toBe(3);
|
expect(anim.__getChildren().length).toBe(3);
|
||||||
|
|
||||||
expect(node.__getValue()).toEqual({
|
expect(node.__getValue()).toEqual({
|
||||||
style: {
|
style: {
|
||||||
|
@ -65,8 +65,8 @@ describe('Animated', () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
node.detach();
|
node.__detach();
|
||||||
expect(anim.getChildren().length).toBe(0);
|
expect(anim.__getChildren().length).toBe(0);
|
||||||
|
|
||||||
anim.setValue(1);
|
anim.setValue(1);
|
||||||
expect(callback.mock.calls.length).toBe(1);
|
expect(callback.mock.calls.length).toBe(1);
|
||||||
|
@ -74,7 +74,7 @@ describe('Animated', () => {
|
||||||
|
|
||||||
it('does not detach on updates', () => {
|
it('does not detach on updates', () => {
|
||||||
var anim = new Animated.Value(0);
|
var anim = new Animated.Value(0);
|
||||||
anim.detach = jest.genMockFunction();
|
anim.__detach = jest.genMockFunction();
|
||||||
|
|
||||||
var c = new Animated.View();
|
var c = new Animated.View();
|
||||||
c.props = {
|
c.props = {
|
||||||
|
@ -84,16 +84,16 @@ describe('Animated', () => {
|
||||||
};
|
};
|
||||||
c.componentWillMount();
|
c.componentWillMount();
|
||||||
|
|
||||||
expect(anim.detach).not.toBeCalled();
|
expect(anim.__detach).not.toBeCalled();
|
||||||
c.componentWillReceiveProps({
|
c.componentWillReceiveProps({
|
||||||
style: {
|
style: {
|
||||||
opacity: anim,
|
opacity: anim,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(anim.detach).not.toBeCalled();
|
expect(anim.__detach).not.toBeCalled();
|
||||||
|
|
||||||
c.componentWillUnmount();
|
c.componentWillUnmount();
|
||||||
expect(anim.detach).toBeCalled();
|
expect(anim.__detach).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ describe('Animated Vectors', () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
node.detach();
|
node.__detach();
|
||||||
|
|
||||||
vec.setValue({x: 1, y: 1});
|
vec.setValue({x: 1, y: 1});
|
||||||
expect(callback.mock.calls.length).toBe(2);
|
expect(callback.mock.calls.length).toBe(2);
|
||||||
|
|
Loading…
Reference in New Issue