From 2c416f5361ed10cd73eb72eb5062261b2e73c18f Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 25 Jul 2026 15:00:56 -0500 Subject: refactor(prototypes): merge casting widgets into Dupre kit --- tests/gallery-probes/probe.mjs | 2 +- tests/gallery-probes/test_dupre_merge.py | 53 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/gallery-probes/test_dupre_merge.py (limited to 'tests/gallery-probes') diff --git a/tests/gallery-probes/probe.mjs b/tests/gallery-probes/probe.mjs index 5f56f46..9d230c0 100644 --- a/tests/gallery-probes/probe.mjs +++ b/tests/gallery-probes/probe.mjs @@ -97,7 +97,7 @@ try { // 1. card count (the instruments/row default is checked in 1h) const cards = await evl(`document.querySelectorAll('.card').length`); - ok('111 cards', cards === 111, `got ${cards}`); + ok('112 cards', cards === 112, `got ${cards}`); // 1b. Every card carries a spec sheet. R58 shipped without one and nothing // noticed — the sheet is the card's actual specification, so a card without diff --git a/tests/gallery-probes/test_dupre_merge.py b/tests/gallery-probes/test_dupre_merge.py new file mode 100644 index 0000000..891b789 --- /dev/null +++ b/tests/gallery-probes/test_dupre_merge.py @@ -0,0 +1,53 @@ +"""The settings-casting widget candidates live in the canonical Dupre kit.""" + +import os +import unittest + + +ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) + + +def source(name): + with open(os.path.join(ROOT, "docs", "prototypes", name)) as handle: + return handle.read() + + +class DupreMergeTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.widgets = source("widgets.js") + cls.additions = source("dupre-kit-additions.js") + cls.gallery = source("panel-widget-gallery.html") + + def test_three_candidates_are_owned_only_by_the_canonical_kit(self): + for name in ("detentFader", "drumRoller", "guardedToggle"): + declaration = f"DUPRE.{name} = function" + self.assertEqual(self.widgets.count(declaration), 1, name) + self.assertNotIn(declaration, self.additions, name) + + def test_detent_fader_brings_its_styles_and_policy(self): + self.assertIn(".dupre-dfader{", self.widgets) + self.assertIn("DUPRE.detentFader.POLICY", self.widgets) + + def test_drum_supports_any_channel_count_and_configurable_range(self): + for fragment in ( + "opts.min !== undefined", + "opts.max !== undefined", + "opts.height !== undefined", + "chans.forEach((c, i) => set(i, c.v))", + ): + self.assertIn(fragment, self.widgets) + + def test_guarded_toggle_throws_through_the_viewer_plane(self): + self.assertIn("lever.style.transformBox = 'view-box'", self.widgets) + self.assertIn("'rotateX(180deg)'", self.widgets) + + def test_gallery_specifies_detent_and_multichannel_drum(self): + self.assertIn("card(C,'A1','Detent fader'", self.gallery) + self.assertIn("channels:[{name:'HIGH'", self.gallery) + self.assertIn("{name:'MID'", self.gallery) + self.assertIn("{name:'LOW'", self.gallery) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3