Restored from slopsmith/slopsmith-plugin-splitscreen#37 — original issue, opened by @topkoa on 2026-05-05.
[restored-from: slopsmith/slopsmith-plugin-splitscreen#37]
Why
Plugin has real state machine (panel modes, focus model, prefs migration). PR #36 hit multiple regressions during review iteration — JT ↔ viz ↔ 2D transitions, pop-out/dock state preservation, _starting/active ordering, pref-shape migration. Easy to break again on next refactor.
Current state: no tests. Adding a small unit-test suite covers ~60% of regression risk without needing browser/DOM/WebSocket mocks.
Scope
JSDOM + vitest (or jest), runs in < 1 second. Test ONLY pure logic — no canvas, no WebSocket, no real DOM layout.
Suggested coverage:
Out of scope
- Canvas context-lock (browser-only behavior)
- Highway WebSocket integration
- Layout / sizing races
- Renderer pre-install ordering (canvas swap)
- Focus border / pointerdown wiring
These need Playwright. Not worth setting up for one plugin; covered by manual testing or upstream slopsmith e2e if/when added.
Setup notes
Plugin loads as a single IIFE today. To unit-test, expose helpers via a test-only window assignment guarded by process.env.NODE_ENV === 'test', OR refactor pure helpers into a separate lib.js that screen.js imports. Latter is cleaner but adds the first build step to the repo.
Slopsmith core uses pytest; no convention for plugin-side JS tests yet. Splitscreen would set the precedent — worth coordinating with byrongamatos/slopsmith maintainers before adding CI.
Risk if not done
Each new feature in this plugin (recently: viz picker, lyrics overlay, focus model) is one bot-review round away from breaking pref migrations or sentinels. Tests would catch those locally instead of after merge.
Why
Plugin has real state machine (panel modes, focus model, prefs migration). PR #36 hit multiple regressions during review iteration — JT ↔ viz ↔ 2D transitions, pop-out/dock state preservation,
_starting/activeordering, pref-shape migration. Easy to break again on next refactor.Current state: no tests. Adding a small unit-test suite covers ~60% of regression risk without needing browser/DOM/WebSocket mocks.
Scope
JSDOM + vitest (or jest), runs in < 1 second. Test ONLY pure logic — no canvas, no WebSocket, no real DOM layout.
Suggested coverage:
migratePanelPrefs— version gate honored (v < 2 force-resetslyrics: false, v >= 2 preserves user toggle),__3d_highway__:→__viz__:highway_3d:legacy migration_modeToArrName—lyrics,jt,viz:<id>,3d(legacy), arbitrary mode → arrName encodingresolveArrIndex— sentinel rejection (__lyrics__,__jumping_tab__:*,__viz__:*), case-insensitive name match_captureFollowerConfig→ URL serialise → FOLLOWER parse →_followerCfgToPrefsLYRICS_VALUE/JUMPING_TAB_VALUE/VIZ_PREFIX(would invalidate existing localStorage prefs)Out of scope
These need Playwright. Not worth setting up for one plugin; covered by manual testing or upstream slopsmith e2e if/when added.
Setup notes
Plugin loads as a single IIFE today. To unit-test, expose helpers via a test-only window assignment guarded by
process.env.NODE_ENV === 'test', OR refactor pure helpers into a separatelib.jsthat screen.js imports. Latter is cleaner but adds the first build step to the repo.Slopsmith core uses pytest; no convention for plugin-side JS tests yet. Splitscreen would set the precedent — worth coordinating with byrongamatos/slopsmith maintainers before adding CI.
Risk if not done
Each new feature in this plugin (recently: viz picker, lyrics overlay, focus model) is one bot-review round away from breaking pref migrations or sentinels. Tests would catch those locally instead of after merge.