diff --git a/src/app/core/layout/store-layout/store-header/immersive-store-header.component.html b/src/app/core/layout/store-layout/store-header/immersive-store-header.component.html index 3904be6..3930a15 100644 --- a/src/app/core/layout/store-layout/store-header/immersive-store-header.component.html +++ b/src/app/core/layout/store-layout/store-header/immersive-store-header.component.html @@ -49,14 +49,17 @@ } - @if (ticketsMenu(); as menu) { - - {{ menu.label }} - + @if (!showHero()) { + @if (ticketsMenu(); as menu) { + + {{ menu.label }} + + } } @if (displayCart()) { diff --git a/src/app/core/layout/store-layout/store-layout.component.spec.ts b/src/app/core/layout/store-layout/store-layout.component.spec.ts index 3598bdb..32f956d 100644 --- a/src/app/core/layout/store-layout/store-layout.component.spec.ts +++ b/src/app/core/layout/store-layout/store-layout.component.spec.ts @@ -305,6 +305,33 @@ describe('StoreLayoutComponent', () => { expect(element.querySelector('app-cart-icon')).not.toBeNull(); }); + it('keeps tickets in the immersive account dropdown while hiding its root action', () => { + const authService = TestBed.inject(AuthService); + (authService.isAuthenticated as any).set(true); + (authService.user as any).set({ + id: 1, + nombre_apellido: 'Ada Lovelace', + email: 'ada@example.com', + }); + tenantState.set({ ...tenant, header_type: 'immersive' }); + + const fixture = TestBed.createComponent(StoreLayoutComponent); + fixture.detectChanges(); + + const element = fixture.nativeElement as HTMLElement; + expect(element.querySelector('[data-testid="store-header-tickets"]')).toBeNull(); + + element.querySelector('app-icon-button[variant="user"] button')?.click(); + fixture.detectChanges(); + + expect(element.querySelector('[data-testid="user-dropdown-account.tickets"]')).not.toBeNull(); + + (fixture.componentInstance as any).isHomeRoute.set(false); + fixture.detectChanges(); + + expect(element.querySelector('[data-testid="store-header-tickets"]')).not.toBeNull(); + }); + it('shows immersive categories below the header and navigates on selection', () => { tenantState.set({ ...tenant, @@ -708,7 +735,7 @@ describe('StoreLayoutComponent', () => { expect( compiled.querySelector('[data-testid="user-dropdown-account.purchases"]'), ).not.toBeNull(); - expect(compiled.querySelector('[data-testid="user-dropdown-account.tickets"]')).toBeNull(); + expect(compiled.querySelector('[data-testid="user-dropdown-account.tickets"]')).not.toBeNull(); expect(router.navigate).not.toHaveBeenCalled(); }); @@ -783,7 +810,7 @@ describe('StoreLayoutComponent', () => { expect(profileLink?.getAttribute('href')).toBe('/mi-cuenta/datos-personales'); expect(purchasesLink?.getAttribute('href')).toBe('/mi-cuenta/compras'); - expect(ticketsLink).toBeUndefined(); + expect(ticketsLink?.getAttribute('href')).toBe('/mi-cuenta/tickets'); expect(logoutButton).toBeDefined(); logoutButton!.click(); diff --git a/src/app/core/layout/store-layout/store-layout.component.ts b/src/app/core/layout/store-layout/store-layout.component.ts index 7ebd321..23a53be 100644 --- a/src/app/core/layout/store-layout/store-layout.component.ts +++ b/src/app/core/layout/store-layout/store-layout.component.ts @@ -211,10 +211,12 @@ export class StoreLayoutComponent implements OnInit { const profile = accountMenu.submenues.find((menu) => menu.code === 'account.profile'); const purchases = accountMenu.submenues.find((menu) => menu.code === 'account.purchases'); + const tickets = accountMenu.submenues.find((menu) => menu.code === 'account.tickets'); return [ ...(profile ? [{ ...accountMenu, route: profile.route }] : []), ...(purchases ? [purchases] : []), + ...(tickets ? [tickets] : []), ]; });