I have a component say Test.component. Here is the HTML of Test.component:
<app-anothercomponent [myProperty]="true" (myMethod)="doWork($event)"> </app-anothercomponent>
I want to write a test/spec to check whether Test.component is rendered with app-anothercomponent with myMethod property wired. i.e if the component has this code:
<app-anothercomponent [myProperty]="true"> </app-anothercomponent>
it should fail as myMethod method is not wired.
I have figured out the way to detect the property being rendered there but not the method, i.e I can detect whether myProperty with the following code:
it('should render app-anothercomponent with #myProperty true', () => {
// Arrange
const compiled = fixture.debugElement.nativeElement;
const selector = compiled.querySelector('app-anothercomponent');
// Assert
expect(selector.myProperty).toBe(true);
});
I am trying to figure out how to write a similar spec like that to make sure myMethod method wiring is present there.