FramedImage and MediaText take a colour for the block behind the photo (sand by default) and MediaText can put the photo in the right-hand column from lg, without changing the reading order. RichParagraph moves to the shared components, a new CallToAction closes a page with a heading, lead and action, and the homepage pricing section gets the anchor #prijzen. A test helper reads the generated CSS rules, since jsdom applies neither media queries nor pseudo-elements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1009 B
TypeScript
25 lines
1009 B
TypeScript
// The CSS rules that target one of the element's classes, as text, including
|
|
// rules inside media queries (with the query in front). jsdom does not apply
|
|
// responsive styles or pseudo-elements, so tests check the generated rules
|
|
// instead of computed styles.
|
|
export function cssRulesFor(element: Element): string[] {
|
|
const classes = [...element.classList].map((name) => `.${name}`);
|
|
const matches = (rule: CSSStyleRule) =>
|
|
classes.some((name) => rule.selectorText.includes(name));
|
|
|
|
const found: string[] = [];
|
|
const walk = (rules: CSSRuleList, prefix: string) => {
|
|
for (const rule of rules) {
|
|
if (rule instanceof CSSStyleRule && matches(rule)) {
|
|
found.push(prefix + rule.cssText);
|
|
} else if (rule instanceof CSSMediaRule) {
|
|
walk(rule.cssRules, `@media ${rule.conditionText} `);
|
|
}
|
|
}
|
|
};
|
|
for (const sheet of document.styleSheets) {
|
|
walk(sheet.cssRules, '');
|
|
}
|
|
return found;
|
|
}
|