Unit testing angular 5 component with @ViewChild
问题 I am using angular 5.2.0. I have a child component import { Component } from '@angular/core'; @Component({ template: `<div><\div>` }) export class ChildComponent { public childMethod() { ... } } and a parent component which accesses the child via ViewChild import { Component, ViewChild } from '@angular/core'; import { ChildComponent } from 'child.component'; @Component({ template: `<child-component #child><\child-component>` }) export class ParentComponent { @ViewChild('child') public child: