fix(profile): serve unified content width and accept full admin range

This commit is contained in:
kate522 committed 2026-09-23 13:23:04 +08:00
1 parent c315297d7f
commit 10c63e02d5
5 files changed
+38 -4

No files matched your search

@@ -420,6 +420,7 @@ test('profile routes load versioned leaf styles and keep dialogs hidden initiall
const userHomeCss = read('assets/css/routes/user-home.css');
const profileLayoutCss = read('assets/css/routes/profile/layout.css');
const frontendLayoutCss = read('assets/css/frontend/layout.css');
const publicBundleCss = read('assets/css/build/public.css');
const userCenterShellCss = read('assets/css/routes/user-center/shell.css');
const profileModalsCss = read('assets/css/routes/profile/modals.css');
const userCenterCreditsCss = read('assets/css/routes/user-center/credits.css');
@@ -453,6 +454,9 @@ test('profile routes load versioned leaf styles and keep dialogs hidden initiall
assert.match(panelFavorites, /array_merge\(\$user_home_render_config, \['wrapper_class' => 'aksrt-user-home__post-list'\]\), \$favorites_query\)/);
assert.doesNotMatch(panelFavorites, /profile-list-item|\$_GET|add_query_arg/);
assert.match(frontendLayoutCss, /\.site-main\.content-shell\.aksrt-profile,[\s\S]*?\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*var\(--content-max, var\(--container, 1440px\)\)/);
// The front end enqueues build/public.min.css, not the frontend/ sources, so a
// source-only edit never reaches the page. The bundle must carry the contract.
assert.match(publicBundleCss, /\.site-main\.content-shell\.aksrt-profile,[\s\S]*?\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*var\(--content-max, var\(--container, 1440px\)\)/);
assert.doesNotMatch(profileLayoutCss, /\.aksrt-profile\.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/);
assert.doesNotMatch(userCenterShellCss, /\.aksrt-user-center \.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/);
assert.match(profileLayoutCss, /\.aksrt-cover-menu__panel\[hidden\]\s*\{\s*display:\s*none\s*!important;\s*\}/);
@@ -661,3 +665,24 @@ test('resource meta CSS uses one canonical direct stylesheet', () => {
);
}
});
test('content max width is one contract from admin option to runtime var', () => {
const globalSchema = read('src/Admin/Schema/GlobalSchema.php');
const layoutSchema = read('assets/admin/src/schema/sections/global/layout.js');
const themeSearch = read('src/Settings/ThemeSearch.php');
const builder = read('src/Frontend/InlineStyleBuilder.php');
// Every width the settings UI offers must pass REST validation, or the save is
// rejected and the rendered width silently keeps the previous value.
const pxOptions = [...layoutSchema.matchAll(/value: (\d+) \}/g)].map((match) => Number(match[1]));
assert.ok(pxOptions.includes(1200));
assert.ok(pxOptions.includes(2200));
const schemaMax = Number(globalSchema.match(/'container_max_width'[\s\S]*?'max' => (\d+)/)[1]);
assert.equal(schemaMax, Math.max(...pxOptions));
assert.match(globalSchema.match(/'container_max_width'[^\n]*/)[0], /'min' => 0/);
assert.match(themeSearch, /max\(1200, min\(2200, \$width\)\)/);
assert.match(builder, /'--content-max'\s*=> \$content_width/);
// The unused no-sidebar width token was removed; no runtime var may revive it.
assert.doesNotMatch(builder, /content-no-sidebar-max/);
});