diff --git a/app/resources/js/layouts/AppLayout.vue b/app/resources/js/layouts/AppLayout.vue index 25a79502..2233c0b0 100644 --- a/app/resources/js/layouts/AppLayout.vue +++ b/app/resources/js/layouts/AppLayout.vue @@ -41,7 +41,13 @@ const navItems = computed(() => [ ]); const currentPageTitle = computed(() => { - return navItems.value.find((i) => i.to === route.path)?.title ?? 'Страница'; + // Сначала короткий title из sidebar-nav (Дашборд/Сделки/…), затем — route.meta.title + // для страниц вне sidebar (Напоминания, Импорт данных), и только потом fallback. + return ( + navItems.value.find((i) => i.to === route.path)?.title ?? + (route.meta.title as string | undefined) ?? + 'Страница' + ); }); async function loadNotifications(): Promise { diff --git a/app/tests/Frontend/AppLayout.spec.ts b/app/tests/Frontend/AppLayout.spec.ts index 691330d6..3a54e1af 100644 --- a/app/tests/Frontend/AppLayout.spec.ts +++ b/app/tests/Frontend/AppLayout.spec.ts @@ -59,6 +59,13 @@ const mountAppLayout = async (path = '/dashboard', user: AuthUser | null = mockU { path: '/billing', component: { template: '
billing
' } }, { path: '/reports', component: { template: '
reports
' } }, { path: '/settings', component: { template: '
settings
' } }, + // Не в sidebar nav, но имеют meta.title — topbar должен брать title оттуда. + { + path: '/reminders', + component: { template: '
reminders
' }, + meta: { title: 'Напоминания' }, + }, + { path: '/import', component: { template: '
import
' }, meta: { title: 'Импорт данных' } }, ], }); await router.push(path); @@ -110,6 +117,18 @@ describe('AppLayout.vue', () => { expect(wrapper.text()).toContain('Дашборд'); }); + it('topbar title для страницы вне sidebar nav берётся из route.meta.title (Напоминания)', async () => { + const wrapper = await mountAppLayout('/reminders'); + // Напоминания нет в sidebar nav (см. тест выше) — title должен прийти из meta, не «Страница». + expect(wrapper.text()).toContain('Напоминания'); + expect(wrapper.text()).not.toContain('Страница'); + }); + + it('topbar title для /import берётся из route.meta.title (Импорт данных)', async () => { + const wrapper = await mountAppLayout('/import'); + expect(wrapper.text()).toContain('Импорт данных'); + }); + it('user-chip показывает initials и shortName из store user', async () => { const wrapper = await mountAppLayout(); const text = wrapper.text();