diff --git a/inc/helpers/header/aksrt-header-navbar.php b/inc/helpers/header/aksrt-header-navbar.php index d2576fd2..3693752c 100644 --- a/inc/helpers/header/aksrt-header-navbar.php +++ b/inc/helpers/header/aksrt-header-navbar.php @@ -343,7 +343,7 @@ if (!function_exists('aksrt_menu_button')) : if ($unread > 0) { $notification_but .= '' . esc_html((string) min(99, $unread)) . ''; } - $notification_but .= "\n"; + $notification_but .= ''; } $sign_but = ''; @@ -372,8 +372,8 @@ if (!function_exists('aksrt_menu_button')) : . esc_attr__('打开搜索', 'aksrt') . '">'; } - // Inline list items retain the reference whitespace between controls. - $sign_but .= "\n"; + // Match the reference's adjacent inline items; text whitespace adds a gap + // before each divider on top of the list item's own horizontal padding. $account = ''; diff --git a/tests/navigation/header-reference-contract.test.cjs b/tests/navigation/header-reference-contract.test.cjs index 56113b07..18d7f2a3 100644 --- a/tests/navigation/header-reference-contract.test.cjs +++ b/tests/navigation/header-reference-contract.test.cjs @@ -51,6 +51,10 @@ foreach (['1', '2', '3'] as $layout) { ob_start(); aksrt_menu_button($ctx); $buttons = ob_get_clean(); $results['desktop'][$layout][$userId] = $buttons; } + $ctx['message_icon_positions'] = ['nav_menu']; + $ctx['messages_url'] = 'https://example.test/messages'; + $ctx['unread_count'] = 3; + ob_start(); aksrt_menu_button($ctx); $results['notifications'][$layout] = ob_get_clean(); } foreach (['center', 'left'] as $mobileLayout) { $ctx = [ @@ -101,6 +105,24 @@ test('mobile search appears in the centered header or left drawer according to l assert.match(output.mobile.left.drawer, /class="toggle-radius main-search-btn"/); }); +test('account icons keep the reference spacing on both sides of each divider', () => { + const output = renderHeaderParts(); + const lists = [ + ...Object.values(output.desktop).flatMap((states) => Object.values(states)), + ...Object.values(output.notifications), + ]; + for (const html of lists) { + const account = html.match(/