testing-library/angular-testing-library

Add an example for testing @Viewchild

adanyc opened this issue · 2 comments

I was wondering if you could add an example for testing @ViewChild.
Viewchild is used when you works with custom elements, like components created in stenciljs.

Something like that

`<button (click)="open()">click
<my-modal #modal>Hello

@ViewChild('modal') modal: ElementRef;

open(){
this.modal.nativeElement.openModal();
}`
How could you test using angular testing library, to capture the modal viewchild

What do you want to test?
"Testing" a viewchild should be the same as a child component.
Using screen and the events you can verify/interact with the view child.

What do you want to test? "Testing" a viewchild should be the same as a child component. Using screen and the events you can verify/interact with the view child.

Thank you!