- textArea.setValue('{"A":"A"}');
- component.noTypePolicyEditorComponent.formatJsonInput();
- expect(component.noTypePolicyEditorComponent.policyJson).toEqual(
- '{\n "A": "A"\n}'
+ textArea.setValue('{"B":"B"}');
+ expect(validJson).toEqual('{"B":"B"}');
+ });
+
+ it("should send null when invalid json", async () => {
+ const textArea: MatInputHarness = await loader.getHarness(
+ MatInputHarness.with({ selector: "#policyJsonTextArea" })
+ );
+ expect(await textArea.getValue()).toEqual('{"A":"A"}');
+
+ let invalidJson: string;
+ component.noTypePolicyEditorComponent.validJson.subscribe(
+ (json: string) => {
+ invalidJson = json;
+ }