fix(navigation): let CSS size the nav logo and drop the inline width cap

The navbar logo carried an inline `height:36px;width:auto;max-width:{logo_width}px`
while `.navbar-logo > img` already owns `height:36px;padding:0 30px`. Under
`box-sizing:border-box` that max-width capped the border box, so the 60px of
horizontal padding stayed inside it and wide logos were squeezed against a
fixed height, breaking the intrinsic aspect ratio.

- Render the nav logo with no inline sizing; CSS alone sizes it.
- Add a `$lazy` argument to jio_get_adaptive_theme_img() so the navbar can emit
  the real src up front instead of a square lazyload placeholder; defaults to
  'auto' so every other caller keeps the lazy_other behaviour.
- Remove the superseded logo_width plumbing: the setting (PHP + VUE schemas),
  Settings::logo_width(), jio_get_site_logo_width(), the --jio-logo-width token
  and the unused has_logo context key.
- Cover the contract in the header reference test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-05 17:50:56 +08:00
1 parent 3ce5bfc20c
commit 8e74b60570
9 files changed
+36 -43

No files matched your search

@@ -131,3 +131,22 @@ test('header source restores the reference typography and Bootstrap control dime
assert.match(mainCss, /\.navbar-avatar\s*\{[^}]*margin-top:\s*3px;[^}]*width:\s*29px;[^}]*height:\s*29px;/s);
assert.doesNotMatch(css, /\.jio-navbar-account|\.jio-nav-avatar|\.navbar-form \.toggle-radius:not|navbar-form\.flex\.ac\s*\{[^}]*min-height|\.navbar-search(?:\.show)?\s*\{[^}]*transform:/s);
});
test('nav logo is sized by CSS alone so the image keeps its aspect ratio', () => {
const mainCss = read('assets/css/main.css');
const render = read('inc/helpers/header/jio-header-render.php');
const helper = read('inc/helpers/template-tags/media-brand.php');
// The reference owns the logo box in CSS: fixed 36px height, auto width, no cap.
assert.match(mainCss, /\.navbar-logo > img \{\s*\n\s*height: 36px;\s*\n\s*padding: 0 30px;\s*\n\}/);
// A max-width on the <img> would cap the border box while the 60px horizontal
// padding stays inside it (box-sizing: border-box), squeezing wide logos.
assert.doesNotMatch(render, /max-width:\s*\d+px[^;]*"\s*\)/);
assert.doesNotMatch(render, /style="height:36px/);
assert.doesNotMatch(helper, /jio_get_site_logo_width|logo_width/);
// Nav logo loads its real src up front; only the shared helper still lazy-loads elsewhere.
assert.match(render, /jio_get_adaptive_theme_img\(\$logo_url, \$logo_dark, \$brand_name, '', false\)/);
assert.match(helper, /\$lazy = 'auto'/);
});