( frames: MotionFrame[], assertions: MotionAssertion[], canvas: Canvas, )
| 213 | * inspect's existing dedupe/collapse/limit/format pipeline. |
| 214 | */ |
| 215 | export function evaluateMotion( |
| 216 | frames: MotionFrame[], |
| 217 | assertions: MotionAssertion[], |
| 218 | canvas: Canvas, |
| 219 | ): LayoutIssue[] { |
| 220 | if (frames.length === 0) return []; |
| 221 | return assertions.flatMap((assertion) => { |
| 222 | switch (assertion.kind) { |
| 223 | case "appearsBy": |
| 224 | return appearsBy(frames, assertion.selector, assertion.bySec); |
| 225 | case "before": |
| 226 | return before(frames, assertion.a, assertion.b); |
| 227 | case "staysInFrame": |
| 228 | return staysInFrame(frames, assertion.selector, canvas); |
| 229 | case "keepsMoving": |
| 230 | return keepsMoving( |
| 231 | frames, |
| 232 | assertion.withinSelector, |
| 233 | assertion.maxStaticSec ?? DEFAULT_MAX_STATIC_SEC, |
| 234 | ); |
| 235 | } |
| 236 | }); |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * Selectors and liveness scopes the in-page sampler must read for a spec. |
no test coverage detected