Latency test: no padding is zero however the DOM spells it

jsdom 30 reports an unset padding as '0', not '0px', which failed the
check for the yellow bars in the jsdom update (#302).
This commit is contained in:
Frederic Jung 2026-11-05 20:25:23 +01:00
parent 7c0f1b3b05
commit 478e767c83
No known key found for this signature in database

View file

@ -57,8 +57,9 @@ test('the slow-city warning box does not restyle the yellow progress bars', () =
const { ev, errors } = load();
// .bar.warn is the yellow bar; the latency box once used a plain .warn class and padded every yellow bar
const st = JSON.parse(ev(`(()=>{const b=document.createElement('div');b.className='bar warn';const w=document.createElement('div');w.className='latwarn';document.body.append(b,w);
const a=getComputedStyle(b),c=getComputedStyle(w);return JSON.stringify({bar:a.paddingTop+a.paddingLeft,box:c.paddingTop});})()`));
assert.ok(!st.bar || st.bar === '0px0px', `yellow bars have no padding (${st.bar})`);
const a=getComputedStyle(b),c=getComputedStyle(w);return JSON.stringify({bar:[a.paddingTop,a.paddingLeft],box:c.paddingTop});})()`));
// No padding reads as '', '0px' or (jsdom 30) '0', depending on the DOM: any of them is zero.
assert.ok(st.bar.every((v) => !v || parseFloat(v) === 0), `yellow bars have no padding (${st.bar})`);
assert.equal(st.box, '8px', 'the warning box keeps its own');
assert.deepEqual(errors, []);
});