fixes to tables and infoboxes

This commit is contained in:
2026-05-21 22:03:50 +02:00
parent 30f1768406
commit 21502b1882
2 changed files with 35 additions and 0 deletions
+20
View File
@@ -11,6 +11,8 @@ const mobileMediaMatch = stylesheet.match(/@media\s*\(max-width:\s*767\.98px\)\s
assert(mobileMediaMatch, "Expected a mobile-width table rendering media query");
const mobileStyles = mobileMediaMatch[0];
const infoboxWidth = "calc(100% - var(--wiki-infobox-reader-width) - var(--wiki-infobox-reader-gutter))";
const infoboxWidthPattern = infoboxWidth.replace(/[()]/g, "\\$&").replace(/\s+/g, "\\s*");
[
".westgate-wiki .wiki-article-prose .wg-mobile-table-scroll",
@@ -54,3 +56,21 @@ assert(
!mobileStyles.includes(".westgate-wiki .wiki-page-content.wiki-article-prose > .card-body {\n\t\tmax-inline-size: 100%;\n\t\toverflow-x: auto"),
"Mobile table scrolling should be scoped to table wrappers, not the whole article body"
);
assert.match(
stylesheet,
new RegExp(
"@media\\s*\\(min-width:\\s*768px\\)\\s*\\{[\\s\\S]*" +
"\\.westgate-wiki\\s+\\.wiki-article-prose\\s+\\.wiki-infobox\\s*~\\s*\\.wg-mobile-table-scroll\\s*\\{[^}]*" +
"width:\\s*" + infoboxWidthPattern + "[^}]*" +
"max-width:\\s*" + infoboxWidthPattern,
"s"
),
"Desktop article tables wrapped by the theme's mobile scroll helper should still shrink beside floated infoboxes"
);
assert.match(
stylesheet,
/@media\s*\(min-width:\s*768px\)\s*\{[\s\S]*\.westgate-wiki\s+\.wiki-article-prose\s+\.wiki-infobox\s*~\s*\.wg-mobile-table-scroll\s*>\s*table\[style\*="width:100%"\],\s*\.westgate-wiki\s+\.wiki-article-prose\s+\.wiki-infobox\s*~\s*\.wg-mobile-table-scroll\s*>\s*table\[style\*="width: 100%"\]\s*\{[^}]*width:\s*100%\s*!important[^}]*max-width:\s*100%/s,
"Fluid-width tables inside the theme's scroll wrapper should fill the shrunken infobox-safe wrapper"
);