Skip to content

Commit 1762ef1

Browse files
committed
docs(docs-infra): modernize remaining shared-docs tests
Follow-up to 3a85031. Replace the last `fixture.detectChanges()` calls in the shared-docs specs with `await fixture.whenStable()`, matching the zoneless "act, wait, assert" pattern used by the rest of adev's tests.
1 parent 8608325 commit 1762ef1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎adev/shared-docs/components/slide-toggle/slide-toggle.component.spec.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ describe('SlideToggle', () => {
3131
expect(component['checked']()).toBeTrue();
3232
});
3333

34-
it('should set active class for button when is checked', () => {
34+
it('should set active class for button when is checked', async () => {
3535
component.checked.set(true);
36-
fixture.detectChanges();
36+
await fixture.whenStable();
3737
const buttonElement: HTMLButtonElement = fixture.nativeElement.querySelector('input');
3838
expect(buttonElement.classList.contains('docs-toggle-active')).toBeTrue();
3939

4040
component.checked.set(false);
41-
fixture.detectChanges();
41+
await fixture.whenStable();
4242
expect(buttonElement.classList.contains('docs-toggle-active')).toBeFalse();
4343
});
4444
});

‎adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ describe('DocViewer', () => {
238238
expect(copyButton).toBeTruthy();
239239
});
240240

241-
it('should not leak any icon text content (so it stays out of the search index)', () => {
241+
it('should not leak any icon text content (so it stays out of the search index)', async () => {
242242
const fixture = TestBed.createComponent(CopyLinkButton);
243243
fixture.componentRef.setInput('href', '#test-section');
244244
fixture.componentRef.setInput('label', 'Test Section');
245245
fixture.componentRef.setInput('matTooltip', 'Copy link to Test Section');
246-
fixture.detectChanges();
246+
await fixture.whenStable();
247247

248248
expect(fixture.nativeElement.textContent.trim()).toBe('');
249249
});

0 commit comments

Comments
 (0)