Skip to content

Commit

Permalink
added Form level tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rani committed May 6, 2022
1 parent 86c7e97 commit 484cb47
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/core/test/Form_test.js
Expand Up @@ -1796,6 +1796,40 @@ describeRepeated("Form common", createFormComponent => {
});
});

describe("nested required", () => {
const schema = {
type: "object",
properties: {
level1: {
type: "object",
required: ["level2"],
properties: {
level2: {
type: "string",
},
},
},
},
};

const onSubmit = sandbox.spy();
const onError = sandbox.spy();
const { node } = createFormComponent({
schema,
formData: {},
onSubmit,
onError,
});

Simulate.submit(node);

it("should not error on nested required fields", () => {
sinon.assert.called(onSubmit);
sinon.assert.notCalled(onError);
expect(node.querySelectorAll(".field-error")).to.not.exist;
});
});

describe("array indices", () => {
const schema = {
type: "array",
Expand Down

0 comments on commit 484cb47

Please sign in to comment.