📅  最后修改于: 2022-03-11 15:01:44.051000             🧑  作者: Mango
import { ChildComponent } from 'childComponent';
...
let component: ThisComponet;
let childComponent: ChildComponent;
.....
declarations: [ChildComponent],
.....
component = fixture.componentInstance;
// to get a handle on the child component, you can select it By.directive
childComponent = fixture.debugElement.query(By.directive(ChildComponent)).componentInstance;
// should have access to your childComponent public properties and methods now