typeit-react
Version:
React component for the most versatile JavaScript animated typing utility on the planet.
29 lines (26 loc) • 620 B
text/typescript
import "@testing-library/jest-dom/vitest";
import { beforeEach } from "vitest";
import "vitest-dom/extend-expect";
beforeEach(() => {
let animation = {
pause: () => {},
play: () => {},
effect: {
getComputedTiming: () => {
return {};
},
getKeyframes: () => [],
},
cancel: () => {},
currentTime: 0,
};
// @ts-ignore
globalThis.HTMLElement.prototype.animate = () => animation;
// @ts-ignore
globalThis.HTMLElement.prototype.getAnimations = () => [animation];
// @ts-ignore
globalThis.requestAnimationFrame = (cb) => {
// @ts-ignore
cb();
};
});