Skip to content

Commit

Permalink
Add test for custom submit buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricmessiant committed Jan 28, 2016
1 parent 6e28306 commit c890062
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ describe("Form", () => {
});
});

describe("Custom submit buttons", () => {
it("should submit the form when clicked", () => {
const onSubmit = sandbox.spy();
const comp = renderIntoDocument(
<Form onSubmit={ onSubmit } schema={ {} }>
<button type="submit">Submit</button>
<button type="submit">Another submit</button>
</Form>
);
const node = findDOMNode(comp);
const buttons = node.querySelectorAll("button[type=submit]");
buttons[0].click();
buttons[1].click();
sinon.assert.calledTwice(onSubmit);
});
});

describe("Custom SchemaField", () => {
const CustomSchemaField = function(props) {
return (<div id="custom"><SchemaField {...props} /></div>);
Expand Down

0 comments on commit c890062

Please sign in to comment.