fix(frontend): sync persisted card rendering

This commit is contained in:
2026-08-17 22:54:19 +08:00
parent e745b2e54b
commit 51c7feac39
3 changed files with 44 additions and 16 deletions
@@ -24,6 +24,8 @@ test('post list DOM follows the Zibll flex and multi-image contract', () => {
test('homepage card mode keeps the Zibll inline-block three-column flow', () => {
const css = read('assets/css/frontend/homepage-fixed/base-2.css');
const responsive = read('assets/css/frontend/homepage-fixed/ajax-tab-error-state.css');
const homepageScript = read('assets/js/homepage-fixed.js');
const scripts = read('src/Core/ScriptsPart1b.php');
const cardModeStart = css.indexOf('.aksrt-homepage__posts[data-view="card"] {');
const cardItemStart = css.indexOf('.aksrt-homepage__posts[data-view="card"] > .posts-item {');
@@ -41,6 +43,22 @@ test('homepage card mode keeps the Zibll inline-block three-column flow', () =>
assert.match(scripts, /\$homepage_style_parts\s*=\s*\[/);
assert.match(scripts, /filemtime\(\$part_path\)/);
assert.doesNotMatch(scripts, /wp_enqueue_style\(\s*'aksrt-homepage-fixed',\s*\$base_uri\s*\.\s*'\/assets\/css\/frontend\/homepage-fixed\.css'/);
const tabletStart = responsive.indexOf('@media (max-width: 991.98px)');
const mobileStart = responsive.indexOf('@media (max-width: 767px)');
const smallMobileStart = responsive.indexOf('@media (max-width: 640px)');
const tablet = responsive.slice(tabletStart, mobileStart);
const mobile = responsive.slice(mobileStart, smallMobileStart);
const smallMobile = responsive.slice(smallMobileStart);
assert.doesNotMatch(tablet, /data-view="card"/);
assert.match(mobile, /data-view="card"[\s\S]*?width:\s*calc\(50% - 10px\)/);
assert.match(mobile, /data-view="card"[\s\S]*?margin:\s*-5px/);
assert.doesNotMatch(smallMobile, /data-view="card"[\s\S]*?width:\s*100%/);
assert.match(homepageScript, /var initialMode = getViewMode\(\)/);
assert.match(homepageScript, /var renderedMode = activePanel \? activePanel\.getAttribute\('data-view'\)/);
assert.match(homepageScript, /renderedMode !== initialMode[\s\S]*?requestHomepagePanel\(activePanel/);
});
test('site shell has one float owner and fluid zones sit outside main', () => {