aboutsummaryrefslogtreecommitdiff
path: root/tests/gallery-probes/probe.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gallery-probes/probe.mjs')
-rw-r--r--tests/gallery-probes/probe.mjs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/gallery-probes/probe.mjs b/tests/gallery-probes/probe.mjs
index 87197d2..ed09d8d 100644
--- a/tests/gallery-probes/probe.mjs
+++ b/tests/gallery-probes/probe.mjs
@@ -1200,6 +1200,46 @@ try {
ok('dipBank word round-trips and jogWheel rotates via dupre- classes',
b4dom === JSON.stringify({ word: '101000', sw: 6, rot: 'rotate(40deg)' }), b4dom);
+ // Batch-5 set() hardening, same detached-host shape: ledRow, pillSlide and
+ // discSwitch clamp their index (discSwitch used to throw); waveRegion keeps
+ // E at least 4 above S however set() is called, not only on the drag path.
+ // ledRow's default index is 5 only for the default program list — a caller's
+ // own items start at 0 (the consoleKeys default-active rule).
+ const clamps5 = await evl(`(() => {
+ const lr = DUPRE.ledRow(document.createElement('div'));
+ lr.set(99); const lrHi = lr.get();
+ lr.set(-3); const lrLo = lr.get();
+ const lrDef = DUPRE.ledRow(document.createElement('div')).get();
+ const lrOwn = DUPRE.ledRow(document.createElement('div'), { items: ['A', 'B', 'C'] }).get();
+ const ps = DUPRE.pillSlide(document.createElement('div'));
+ ps.set(9); const psHi = ps.get();
+ ps.set(-1); const psLo = ps.get();
+ let dsHi;
+ try { const ds = DUPRE.discSwitch(document.createElement('div')); ds.set(9); dsHi = ds.get(); }
+ catch (e) { dsHi = 'threw'; }
+ const wr = DUPRE.waveRegion(document.createElement('div'));
+ wr.set(80, 20); const { s: wrS, e: wrE } = wr.get();
+ wr.set(-10, 200); const { s: wrS2, e: wrE2 } = wr.get();
+ return JSON.stringify({ lrHi, lrLo, lrDef, lrOwn, psHi, psLo, dsHi, wrS, wrE, wrS2, wrE2 });
+ })()`);
+ ok('batch-5 set() clamps: ledRow/pillSlide/discSwitch index, waveRegion S/E order',
+ clamps5 === JSON.stringify({ lrHi: 7, lrLo: 0, lrDef: 5, lrOwn: 0, psHi: 2, psLo: 0, dsHi: 2, wrS: 80, wrE: 84, wrS2: 0, wrE2: 100 }), clamps5);
+
+ // entryKeypad buffer round-trip on a detached host: digits accumulate, the
+ // buffer caps at 6, keys outside the contract's set are ignored, ✗ clears,
+ // ✓ commits and clears.
+ const b5dom = await evl(`(() => {
+ const kp = DUPRE.entryKeypad(document.createElement('div'));
+ ['1', '2', '3'].forEach(k => kp.press(k)); const buf3 = kp.get();
+ kp.press('X'); const stray = kp.get();
+ ['4', '5', '6', '7'].forEach(k => kp.press(k)); const cap = kp.get();
+ kp.press('✗'); const clr = kp.get();
+ kp.press('1'); kp.press('✓'); const commit = kp.get();
+ return JSON.stringify({ buf3, stray, cap, clr, commit });
+ })()`);
+ ok('entryKeypad buffers digits only, caps at 6, clears and commits',
+ b5dom === JSON.stringify({ buf3: '123', stray: '123', cap: '123456', clr: '', commit: '' }), b5dom);
+
// late exceptions from interactions
const errs2 = events.filter(e => e.method === 'Runtime.exceptionThrown');
ok('no exceptions after interaction', errs2.length === 0);