diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gallery-probes/probe.mjs | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/tests/gallery-probes/probe.mjs b/tests/gallery-probes/probe.mjs index 7b9ba5e..051d575 100644 --- a/tests/gallery-probes/probe.mjs +++ b/tests/gallery-probes/probe.mjs @@ -1000,28 +1000,29 @@ try { const h = document.querySelector('#card-N20').gw; if (typeof h.setStyle !== 'function' || !GW.splitFlap.STYLES || !GW.splitFlap.STYLES.skin) return 'no skin axis'; const skins = Object.keys(GW.splitFlap.STYLES.skin); + if (skins[0] !== 'white') return 'white must list first, got: ' + skins.join(','); if (!['dark','white','light','paper'].every(k => skins.includes(k))) return 'skins are: ' + skins.join(','); const ink = () => getComputedStyle(document.querySelector('#card-N20 .fh')).color; const lum = c => { const m = c.match(/[0-9]+/g).map(Number); return m[0] + m[1] + m[2]; }; - const dark = ink(); - h.setStyle('skin', 'white'); - const white = ink(); + const white = ink(); // the card's default skin is white ink + if (white !== 'rgb(255, 255, 255)') return 'default ink is not white: ' + white; + h.setStyle('skin', 'dark'); + const cream = ink(); h.setStyle('skin', 'light'); const light = ink(); const gotClass = document.querySelector('#card-N20 .flap').classList.contains('flap-light'); h.setStyle('skin', 'paper'); const paper = ink(); const paperClass = document.querySelector('#card-N20 .flap').classList.contains('flap-paper'); - h.setStyle('skin', 'dark'); + h.setStyle('skin', 'white'); const back = ink(); if (!gotClass) return 'light skin class missing'; if (!paperClass) return 'paper skin class missing'; - if (white !== 'rgb(255, 255, 255)') return 'white skin ink is ' + white; - if (!(lum(dark) > 400 && lum(dark) < 760 && lum(light) < 300 && lum(paper) < 300)) return 'inks wrong: ' + dark + ' / ' + light + ' / ' + paper; - if (back !== dark) return 'did not restore dark: ' + back; + if (!(lum(cream) > 400 && lum(cream) < 760 && lum(light) < 300 && lum(paper) < 300)) return 'inks wrong: ' + cream + ' / ' + light + ' / ' + paper; + if (back !== white) return 'did not restore the white default: ' + back; return 'ok'; })()`); - ok('N20 skins: cream dark, white ink, ivory board, white board — all switch and restore', n20e === 'ok', n20e); + ok('N20 skins: white default first, cream, ivory board, white board — all switch and restore', n20e === 'ok', n20e); const n20fnt = await evl(`(() => { const h = document.querySelector('#card-N20').gw; @@ -1057,6 +1058,7 @@ try { const h = document.querySelector('#card-N20').gw; if (typeof h.setFlapMs !== 'function' || typeof h.flapMs !== 'function') return 'no speed api'; const before = h.flapMs(); + if (before !== 85) return 'default flap rate is ' + before + ', want 85'; h.setFlapMs(120); if (h.flapMs() !== 120) return 'setFlapMs did not take: ' + h.flapMs(); const slider = document.querySelector('#card-N20 input[type=range]'); @@ -1117,6 +1119,18 @@ try { ok('N20 rests under reduced motion (no self-advancing dwell chain)', rm1 === rm2.r && rm2.anims === 0, JSON.stringify({ before: rm1, after: rm2.r, anims: rm2.anims })); + // Every card's ID badge is its own anchor: click it and the URL carries + // the card's deep link. + const anchors = await evl(`(() => { + const bad = [...document.querySelectorAll('.card .wname .no')] + .filter(n => n.tagName !== 'A' || n.getAttribute('href') !== '#' + n.closest('.card').id) + .map(n => n.textContent); + const count = document.querySelectorAll('.card .wname a.no').length; + if (bad.length) return 'not anchors: ' + bad.slice(0, 5).join(' '); + return count === document.querySelectorAll('.card').length ? 'ok' : 'anchor count ' + count; + })()`); + ok('every card ID badge links to its own anchor', anchors === 'ok', anchors); + // late exceptions from interactions const errs2 = events.filter(e => e.method === 'Runtime.exceptionThrown'); ok('no exceptions after interaction', errs2.length === 0); |
