UNPKG

@gitlab/ui

Version:
20 lines (17 loc) 1.1 kB
/** * Wrapper around setTimeout which executes immediately in visual tests * in order to avoid flaky tests */ function setStoryTimeout(fn, timeout) { return setTimeout(fn, process.env.IS_VISUAL_TEST ? 0 : timeout); } // adopted this method from Bootstraps utils // https://github.com/bootstrap-vue/bootstrap-vue/blob/2fd03f0b1d0cc41f9930078ba8b1c16b10e4ac2f/tests/utils.js#L6 var waitForAnimationFrame = function waitForAnimationFrame() { return new Promise(function (resolve) { return requestAnimationFrame(resolve); }); }; var getResetAnimationsCSS = function getResetAnimationsCSS() { return "\n *, *::after, *::before {\n -webkit-transition: none !important;\n -moz-transition: none !important;\n -ms-transition: none !important;\n -o-transition: none !important;\n transition: none !important;\n\n -webkit-animation: none !important;\n -moz-animation: none !important;\n -ms-animation: none !important;\n -o-animation: none !important;\n animation: none !important;\n }"; }; export { getResetAnimationsCSS, setStoryTimeout, waitForAnimationFrame };