+
+ it("should call ngOnChanges when minimiseTrigger is changed", async() => {
+ spyOn(component.policyTypeComponent, "ngOnChanges");
+ component.minimiseTrigger = !component.minimiseTrigger;
+ fixture.detectChanges();
+ expect(component.policyTypeComponent.ngOnChanges).toHaveBeenCalled();
+ });
+
+ it("should close all tables when the types are refreshed", async() => {
+ const ele = fixture.debugElement.nativeElement.querySelector("#visible");
+ ele.click();
+ fixture.detectChanges();
+ component.policyTypeComponent.ngOnChanges({
+ minimiseTrigger: new SimpleChange(null, null, component.policyTypeComponent.minimiseTrigger)
+ });
+ fixture.detectChanges();
+ expect(ele.innerText).toEqual("expand_more");
+ });
+
+ @Component({
+ selector: `policy-type-host-component`,
+ template: `<nrcp-policy-type
+ [minimiseTrigger]="this.minimiseTrigger"
+ ></nrcp-policy-type>`,
+ })
+ class TestPolicyTypeHostComponent {
+ @ViewChild(PolicyTypeComponent)
+ policyTypeComponent: PolicyTypeComponent;
+ minimiseTrigger: boolean = false;
+ }