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) {
-
-
-
+ }
}
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);
});
}));