MCPcopy
hub / github.com/formkit/auto-animate / withAnimationObserver

Function withAnimationObserver

tests/e2e/utils.ts:14–30  ·  view source on GitHub ↗
(page: Page, selector: string)

Source from the content-addressed store, hash-verified

12}
13
14export async function withAnimationObserver(page: Page, selector: string) {
15 await page.waitForSelector(selector)
16 await page.evaluate(() => {
17 const w = window as any
18 if (!w.__aa__) {
19 w.__aa__ = {
20 activeAnimations(element: Element) {
21 const anims = (element.getAnimations ? element.getAnimations({ subtree: true }) : []) as Animation[]
22 return anims.filter((a) => a.playState === 'running' || (a.currentTime && a.effect)).length
23 },
24 }
25 }
26 })
27 return {
28 count: async () => page.evaluate((sel) => (window as any).__aa__.activeAnimations(document.querySelector(sel)!), selector),
29 }
30}
31
32export async function waitForActiveAnimations(page: Page, selector: string, timeoutMs = 1000) {
33 await page.waitForFunction(

Callers 6

animations.spec.tsFile · 0.90
disable.spec.tsFile · 0.90
vue-plugin.spec.tsFile · 0.90
vue-vif.spec.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…