X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy%2Fno-type-policy-editor%2Fno-type-policy-editor.component.spec.ts;h=7fb64c4acafc753a7e9f225136e22356538b4f65;hb=66372cb88b6b3e94dada9197c5efeaa7b2c93e17;hp=fb3a6a603a2c666fd441eb1681e6818574facecc;hpb=162646a6a5c1393d6b146b7badba67ad8a0b375c;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.spec.ts b/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.spec.ts index fb3a6a6..7fb64c4 100644 --- a/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.spec.ts +++ b/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.spec.ts @@ -69,15 +69,6 @@ describe("NoTypePolicyEditorComponent", () => { expect(component).toBeTruthy(); }); - it("should be added to form group with required validator", async () => { - let textArea: MatInputHarness = await loader.getHarness( - MatInputHarness.with({ selector: "#policyJsonTextArea" }) - ); - - expect(formGroup.get("policyJsonTextArea")).toBeTruthy(); - expect(await textArea.isRequired()).toBeTruthy(); - }); - it("should contain provided policy json and enabled Format button", async () => { let textArea: MatInputHarness = await loader.getHarness( MatInputHarness.with({ selector: "#policyJsonTextArea" }) @@ -91,7 +82,7 @@ describe("NoTypePolicyEditorComponent", () => { }); it("Format button should be disabled when json not valid", async () => { - const ele = formGroup.get("policyJsonTextArea"); + const ele = component.noTypePolicyEditorComponent.instanceForm.get("policyJsonTextArea"); ele.setValue("{"); let formatButton: MatButtonHarness = await loader.getHarness( @@ -101,7 +92,7 @@ describe("NoTypePolicyEditorComponent", () => { }); it("should format unformatted json", async () => { - const textArea = formGroup.get("policyJsonTextArea"); + const textArea = component.noTypePolicyEditorComponent.instanceForm.get("policyJsonTextArea"); textArea.setValue('{"A":"A"}'); component.noTypePolicyEditorComponent.formatJsonInput(); expect(component.noTypePolicyEditorComponent.policyJson).toEqual( @@ -113,13 +104,11 @@ describe("NoTypePolicyEditorComponent", () => { selector: `no-type-policy-editor-host-component`, template: ``, }) class TestNoTypePolicyEditorComponentHostComponent { @ViewChild(NoTypePolicyEditorComponent) noTypePolicyEditorComponent: NoTypePolicyEditorComponent; - instanceForm: FormGroup = formGroup; policyJson: string = '{"A":"A"}'; } });