I'm quite new to angular 2.
I have a component which in turn has some other components in its template.
How do I write unit tests to check if my parent component consists of other components.
Mentioning a sample or directing me to a resource would be really helpful.
MyComponent.ts:
import { Component } from '@angular/core';
@Component({
selector: 'my-component',
templateUrl: `<div>
<other-component></other-component>
</div>`
})
export class MyComponent{
}
OtherComponent.ts:
import { Component } from '@angular/core';
@Component({
selector: 'other-component',
templateUrl: `<div>
<h1>Other Component</h1>
</div>`
})
export class OtherComponent{
}
Copyright Notice:Content Author:「Chan15」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40541123/how-to-unit-test-if-an-angular-2-component-contains-another-component