Refactor wakeCanvasEngine and add test seams

Refactor wakeCanvasEngine function and expose internal state for testing.
This commit is contained in:
Eldoon Nemar authored and mc-bot committed 2026-05-30 20:04:46 +00:00
1 parent e70e1543f9
commit fa4817ee46
1 file changed
+11 -3
+11 -3
View File
@@ -675,7 +675,7 @@
}
}
window._wakeCanvasEngine = function() {
function wakeCanvasEngine() {
if (!isAnimating && activeAnimations.length > 0) {
const isPaused = VCR.mode === 'PAUSED' || VCR.speed === 0;
if (!isPaused) {
@@ -683,7 +683,7 @@
requestAnimationFrame(renderAnimations);
}
}
};
}
function vcrFormatTime(tsMs) {
const d = new Date(tsMs);
@@ -746,7 +746,7 @@
updateVCRLcd();
// WAKE THE ENGINE: If we unpaused or changed speed above 0, kickstart the canvas
if (window._wakeCanvasEngine) window._wakeCanvasEngine();
wakeCanvasEngine();
}
function dbPacketToLive(pkt) {
@@ -2706,6 +2706,14 @@
};
window._liveRebuildFeedList = function() { return rebuildFeedList(); };
// PR #1490 test seams: Expose internal state for Playwright assertions
window._liveDrawAnimatedLine = drawAnimatedLine;
window._liveTestSeams = {
getAnimCount: () => activeAnimations.length,
isAnimating: () => isAnimating,
getPathCount: () => (typeof recentPaths !== 'undefined' ? recentPaths.length : 0)
};
async function replayRecent() {
try {
// Single bulk fetch with expand=observations — no N+1 calls