Skip to content

test(core): Adds and uses a waitFor helper#67101

Open
atscott wants to merge 1 commit intoangular:mainfrom
atscott:testing-library
Open

test(core): Adds and uses a waitFor helper#67101
atscott wants to merge 1 commit intoangular:mainfrom
atscott:testing-library

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Feb 17, 2026

This adds a waitFor utility inspired by tools like testing-library and convers a zone-based test to the zoneless waitFor

@pullapprove pullapprove bot requested a review from josephperrott February 17, 2026 18:59
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Feb 17, 2026
@ngbot ngbot bot added this to the Backlog milestone Feb 17, 2026
@atscott atscott requested review from thePunderWoman and removed request for josephperrott February 17, 2026 19:03
@pullapprove pullapprove bot requested a review from josephperrott February 17, 2026 19:03
Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fixture.detectChanges();
expect(fixture.nativeElement.textContent).toBe('');
fixture.componentInstance.case.set(3);
await expectScreenText(' case 3-4 ', {container: fixture.nativeElement});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only feedback is that the passing of {container: fixture.nativeElement} is very repetitive. I wish this was default and instead could just be overridden.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is the node tests, where we can't just read document, combined with the fact that TestBed isn't like catalyst where we can get the last fixture. Maybe we can extend TestBed static to have something like TestBed.lastFixture() or something.

This adds a waitFor utility inspired by tools like testing-library
and convers a zone-based test to the zoneless waitFor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants