Make AnimatedMock instantly complete spring and timing animations

Summary:
Some MP E2E tests started failing when I introduced AnimatedMock (D13811035) with this error:

> message: Timeout exception: Message: element located by locator {"id":"mp_your_items_tab_button"} is not visible

The test relied on the button to animate in, which AnimatedMock disabled. The fix is to complete animations instantly in AnimatedMock. This diff implements that for spring and timing.

Reviewed By: cpojer

Differential Revision: D14036172

fbshipit-source-id: 18a422ce8ef6de05ff9224c94214524511a76949
This commit is contained in:
Peter Argany 2019-02-12 10:07:02 -08:00 коммит произвёл Facebook Github Bot
Родитель e2bd7db732
Коммит 2d86d38e75
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -52,14 +52,28 @@ const spring = function(
value: AnimatedValue | AnimatedValueXY,
config: SpringAnimationConfig,
): CompositeAnimation {
return emptyAnimation;
const anyValue: any = value;
return {
...emptyAnimation,
start: (callback?: ?EndCallback): void => {
anyValue.setValue(config.toValue);
callback && callback({finished: true});
},
};
};
const timing = function(
value: AnimatedValue | AnimatedValueXY,
config: TimingAnimationConfig,
): CompositeAnimation {
return emptyAnimation;
const anyValue: any = value;
return {
...emptyAnimation,
start: (callback?: ?EndCallback): void => {
anyValue.setValue(config.toValue);
callback && callback({finished: true});
},
};
};
const decay = function(