Two CSS checks read jsdom 31 as well as 30

jsdom 31 (#327) serializes calc() with its terms sorted and expands the
overflow shorthand into overflow-y; the diagnostic readout and puzzle
dock tests now accept both.
This commit is contained in:
Frederic Jung 2026-11-09 13:30:28 +01:00
parent d6b08dded3
commit f00bc733d0
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View file

@ -103,7 +103,8 @@ test('on a 360 px phone the readout wraps inside the screen instead of running o
try {
ev('diagOn(true)');
const st = ev('document.getElementById("diag").style.cssText');
assert.match(st, /max-width: calc\(100vw - 32px\)/);
// jsdom 31 serializes calc() with its terms sorted (calc(-32px + 100vw)); a browser keeps them as written.
assert.match(st, /max-width: calc\((100vw - 32px|-32px \+ 100vw)\)/);
assert.match(st, /white-space: pre-wrap/);
assert.match(st, /pointer-events: none/, 'it never takes a tap meant for the map');
} finally { h.done(); }

View file

@ -66,7 +66,8 @@ test('a link’s card: sizes first, then what it carries, then its routing', ()
test('nothing on a phone scrolls by design: the bar and the card’s body have no scroll of their own', () => {
const { ev, errors } = load();
const rules = JSON.parse(ev(`JSON.stringify([...document.styleSheets].flatMap(s=>[...s.cssRules]).filter(r=>r.media&&/max-width: ?760px/.test(r.media.mediaText))
.flatMap(m=>[...m.cssRules]).map(r=>({sel:r.selectorText||'',ov:r.style.getPropertyValue('overflow')+r.style.getPropertyValue('overflow-y'),mh:r.style.getPropertyValue('max-height')})))`));
.flatMap(m=>[...m.cssRules]).map(r=>({sel:r.selectorText||'',ov:r.style.getPropertyValue('overflow-y')||r.style.getPropertyValue('overflow'),mh:r.style.getPropertyValue('max-height')})))`));
// (jsdom 31 expands the overflow shorthand into overflow-y too; jsdom 30 kept only the shorthand.)
const dock = rules.find((r) => r.sel === '#pzBox.dock');
assert.ok(dock && dock.ov === 'visible' && dock.mh === 'none', 'the bar is as tall as it needs, never a scroll box');
assert.ok(!rules.some((r) => /pzd-/.test(r.sel) && /auto|scroll/.test(r.ov)), 'no part of the bar or the cards scrolls');