Skip to content

test(overlay): use static queries w/ overlay containers #15301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cdk/overlay/fullscreen-overlay-container.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('FullscreenOverlayContainer', () => {
providers: [Overlay],
})
class TestComponentWithTemplatePortals {
@ViewChild(CdkPortal) templatePortal: CdkPortal;
@ViewChild(CdkPortal, {static: true}) templatePortal: CdkPortal;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should put in detectChanges calls instead? My guess here is that the first test used static queries and then we ended up copying it everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to use static for this one since it keeps the test as running just one change detection, even though it's largely trivial.


constructor(public viewContainerRef: ViewContainerRef) { }
}
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/overlay-container.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('OverlayContainer', () => {
providers: [Overlay],
})
class TestComponentWithTemplatePortals {
@ViewChild(CdkPortal) templatePortal: CdkPortal;
@ViewChild(CdkPortal, {static: true}) templatePortal: CdkPortal;

constructor(public viewContainerRef: ViewContainerRef) { }
}
Expand Down