UNPKG

1.01 kBJavaScriptView Raw
1/**
2 * Wrapper around setTimeout which executes immediately in visual tests
3 * in order to avoid flaky tests
4 */
5export function setStoryTimeout(fn, timeout) {
6 return setTimeout(fn, process.env.IS_VISUAL_TEST ? 0 : timeout);
7}
8
9// adopted this method from Bootstraps utils
10// https://github.com/bootstrap-vue/bootstrap-vue/blob/2fd03f0b1d0cc41f9930078ba8b1c16b10e4ac2f/tests/utils.js#L6
11export const waitForAnimationFrame = () =>
12 new Promise((resolve) => {
13 requestAnimationFrame(resolve);
14 });
15
16export const getResetAnimationsCSS = () => `
17 *, *::after, *::before {
18 -webkit-transition: none !important;
19 -moz-transition: none !important;
20 -ms-transition: none !important;
21 -o-transition: none !important;
22 transition: none !important;
23
24 -webkit-animation: none !important;
25 -moz-animation: none !important;
26 -ms-animation: none !important;
27 -o-animation: none !important;
28 animation: none !important;
29 }
30
31 input, textarea {
32 caret-color: transparent !important;
33 }`;