test: cover responsive no-script acceptance

This commit is contained in:
2026-09-05 01:26:56 +03:00
parent f58b079c18
commit c6e17ad196
2 changed files with 39 additions and 5 deletions

View File

@@ -109,9 +109,16 @@ test('exposes the complete semantic portfolio from the generated document', asyn
const content = hero.querySelector('.hero-journey__content')!;
const heroStyle = getComputedStyle(hero);
const contentStyle = getComputedStyle(content);
const compact = innerWidth < 768;
const expectedPadding = compact
? Math.min(72, Math.max(32, innerHeight * 0.09))
: Math.min(128, Math.max(56, innerHeight * 0.12));
const expectedWidth = compact
? innerWidth - 32
: Math.min(544, innerWidth * 0.39);
return {
preservesPadding: Math.abs(Number.parseFloat(heroStyle.paddingTop) - innerHeight * 0.12) < 0.01,
preservesWidth: Math.abs(Number.parseFloat(contentStyle.width) - Math.min(544, innerWidth * 0.39)) < 0.1,
preservesPadding: Math.abs(Number.parseFloat(heroStyle.paddingTop) - expectedPadding) < 0.01,
preservesWidth: Math.abs(Number.parseFloat(contentStyle.width) - expectedWidth) < 0.1,
position: contentStyle.position,
zIndex: contentStyle.zIndex,
};