import { TestbedHarnessEnvironment } from "@angular/cdk/testing/testbed";
import { Component, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
+import { OptionHarnessFilters } from "@angular/material/core/testing";
import { MatSelectModule } from "@angular/material/select";
import { MatSelectHarness } from "@angular/material/select/testing";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { of } from "rxjs/observable/of";
-import { Ric } from "src/app/interfaces/ric";
-import { PolicyService } from "src/app/services/policy/policy.service";
+import { Ric } from "@interfaces/ric";
+import { PolicyService } from "@services/policy/policy.service";
import { RicSelectorComponent } from "./ric-selector.component";
expect(component).toBeTruthy();
});
- it("no ric selected when no ric provided", async () => {
+ it("no ric selected", async () => {
let ricSelector: MatSelectHarness = await loader.getHarness(
MatSelectHarness.with({ selector: "#ricSelector" })
);
expect(count).toEqual(2);
});
+ it("should send selected ric", async () => {
+ let selectedRic: string;
+ component.ricSelectorComponent.selectedRic.subscribe((ric: string) => {
+ selectedRic = ric;
+ });
+
+ let ricSelector: MatSelectHarness = await loader.getHarness(
+ MatSelectHarness.with({ selector: "#ricSelector" })
+ );
+ await ricSelector.clickOptions({ text: "ric1" });
+
+ expect(selectedRic).toEqual("ric1");
+ });
+
@Component({
selector: `ric-selector-host-component`,
template: `<nrcp-ric-selector
})
class TestRicSelectorHostComponent {
@ViewChild(RicSelectorComponent)
- private ricSelectorComponent: RicSelectorComponent;
+ ricSelectorComponent: RicSelectorComponent;
policyTypeName: string = "policyTypeName";
}
});