diff --git a/packages/platform-server/test/incremental_hydration_spec.ts b/packages/platform-server/test/incremental_hydration_spec.ts
index 7c55819c70f..4be2b69ef28 100644
--- a/packages/platform-server/test/incremental_hydration_spec.ts
+++ b/packages/platform-server/test/incremental_hydration_spec.ts
@@ -1822,6 +1822,9 @@ describe('platform-server partial hydration integration', () => {
describe('client side navigation', () => {
beforeEach(() => {
+ // This test emulates client-side behavior, set global server mode flag to `false`.
+ globalThis['ngServerMode'] = false;
+
TestBed.configureTestingModule({
providers: [
{provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID},
@@ -1830,32 +1833,28 @@ describe('platform-server partial hydration integration', () => {
});
});
+ afterEach(() => {
+ globalThis['ngServerMode'] = undefined;
+ });
+
it('should not try to hydrate in CSR only cases', async () => {
@Component({
selector: 'app',
template: `
-
Defer block rendered!
+ } @placeholder { + Outer block placeholder + } `, }) - class SimpleComponent { - value = signal('start'); - fnA() {} - fnB() { - this.value.set('end'); - } - } + class SimpleComponent {} + const fixture = TestBed.createComponent(SimpleComponent); fixture.detectChanges(); + // Verify that `hydrate when true` doesn't trigger rendering of the main + // content in client-only use-cases (expecting to see placeholder content). expect(fixture.nativeElement.innerHTML).toContain('Outer block placeholder'); }); });