(duration: number)
| 4 | import type { RuntimeTimelineLike } from "./types"; |
| 5 | |
| 6 | function createMockTimeline(duration: number): RuntimeTimelineLike { |
| 7 | const state = { time: 0, paused: true, duration }; |
| 8 | return { |
| 9 | play: () => { |
| 10 | state.paused = false; |
| 11 | }, |
| 12 | pause: () => { |
| 13 | state.paused = true; |
| 14 | }, |
| 15 | seek: (time: number) => { |
| 16 | state.time = time; |
| 17 | }, |
| 18 | totalTime: (time: number) => { |
| 19 | state.time = time; |
| 20 | }, |
| 21 | time: () => state.time, |
| 22 | duration: () => state.duration, |
| 23 | add: () => {}, |
| 24 | paused: (value?: boolean) => { |
| 25 | if (typeof value === "boolean") { |
| 26 | state.paused = value; |
| 27 | } |
| 28 | return state.paused; |
| 29 | }, |
| 30 | timeScale: () => {}, |
| 31 | set: () => {}, |
| 32 | getChildren: () => [], |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | function createPaddableMockTimeline(duration: number): RuntimeTimelineLike { |
| 37 | const timeline = createMockTimeline(duration) as RuntimeTimelineLike & { |
no outgoing calls
no test coverage detected