From ab0e3e0814769e36bcf2661ec2431646ffdd9d50 Mon Sep 17 00:00:00 2001 From: Sascha Szott Date: Sun, 27 Sep 2026 15:52:20 +0200 Subject: [PATCH 1/2] adjust lang-switch component tests to handle deferred rendering --- src/app/shared/lang-switch/lang-switch.component.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/shared/lang-switch/lang-switch.component.spec.ts b/src/app/shared/lang-switch/lang-switch.component.spec.ts index 5d864de0c9d..cf40c8278b7 100644 --- a/src/app/shared/lang-switch/lang-switch.component.spec.ts +++ b/src/app/shared/lang-switch/lang-switch.component.spec.ts @@ -12,6 +12,7 @@ import { } from '@angular/core'; import { ComponentFixture, + DeferBlockState, TestBed, waitForAsync, } from '@angular/core/testing'; @@ -91,7 +92,7 @@ describe('LangSwitchComponent', () => { provideHttpClientTesting(), ], }).compileComponents() - .then(() => { + .then(async () => { translate = TestBed.inject(TranslateService); translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code)); translate.setFallbackLang('en'); @@ -103,6 +104,9 @@ describe('LangSwitchComponent', () => { de = fixture.debugElement; langSwitchElement = de.nativeElement; fixture.detectChanges(); + // The language dropdown is wrapped in a @defer block (not rendered during SSR), so we need to render it explicitly + const deferBlock = await fixture.getDeferBlocks(); + await deferBlock[0].render(DeferBlockState.Complete); }); })); From d1221dcfe0c0838a432dea1caa73187b8d320396 Mon Sep 17 00:00:00 2001 From: Sascha Szott Date: Sun, 27 Sep 2026 15:54:10 +0200 Subject: [PATCH 2/2] do not include language switch component in SSR result --- .../lang-switch/lang-switch.component.html | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/app/shared/lang-switch/lang-switch.component.html b/src/app/shared/lang-switch/lang-switch.component.html index 6daba932b8d..90ff4761336 100644 --- a/src/app/shared/lang-switch/lang-switch.component.html +++ b/src/app/shared/lang-switch/lang-switch.component.html @@ -1,29 +1,32 @@ @if (moreThanOneLanguage) { -