+ expect(jsonText.innerText).toEqual('"{ \\"qosObjectives\\": \\"test\\" }"');
+ });
+
+ it("should present error info in JSON div", () => {
+ const errors = [
+ {
+ keyword: "required",
+ dataPath: "/scope/qosObjectives",
+ schemaPath: "#/properties/scope/qosObjectives/required",
+ params: { missingProperty: "priorityLevel" },
+ message: "should have required property 'priorityLevel'",
+ },
+ ];
+ componentUnderTest.validationErrors(errors);
+ hostFixture.detectChanges();
+ componentUnderTest.prettyValidationErrors;
+ hostFixture.detectChanges();
+
+ // Show the JSON
+ let jsonHeading = hostFixture.debugElement.nativeElement.querySelector(
+ "#jsonHeading"
+ );
+ expect(jsonHeading).toBeTruthy();
+ jsonHeading.click();
+ hostFixture.detectChanges();
+
+ let jsonDiv = hostFixture.debugElement.nativeElement.querySelector(
+ "#jsonDiv"
+ );
+ expect(jsonDiv.innerText).toContain("Not valid — errors:");
+ expect(jsonDiv.innerText).toContain(
+ "scope.qosObjectives: should have required property 'priorityLevel'"
+ );