FormsySpec: test that `onChange` is called only once

This commit is contained in:
Stephen Demjanenko 2015-11-03 18:24:09 -08:00
parent b39fd2ed74
commit fec4576d1b
1 changed files with 4 additions and 4 deletions

View File

@ -350,7 +350,7 @@ export default {
}, },
'should trigger onChange when form element is changed': function (test) { 'should trigger onChange once when form element is changed': function (test) {
const hasChanged = sinon.spy(); const hasChanged = sinon.spy();
const form = TestUtils.renderIntoDocument( const form = TestUtils.renderIntoDocument(
@ -359,12 +359,12 @@ export default {
</Formsy.Form> </Formsy.Form>
); );
TestUtils.Simulate.change(TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'), {target: {value: 'bar'}}); TestUtils.Simulate.change(TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'), {target: {value: 'bar'}});
test.equal(hasChanged.called, true); test.equal(hasChanged.calledOnce, true);
test.done(); test.done();
}, },
'should trigger onChange when new input is added to form': function (test) { 'should trigger onChange once when new input is added to form': function (test) {
const hasChanged = sinon.spy(); const hasChanged = sinon.spy();
const TestForm = React.createClass({ const TestForm = React.createClass({
@ -394,7 +394,7 @@ export default {
const form = TestUtils.renderIntoDocument(<TestForm/>); const form = TestUtils.renderIntoDocument(<TestForm/>);
form.addInput(); form.addInput();
immediate(() => { immediate(() => {
test.equal(hasChanged.called, true); test.equal(hasChanged.calledOnce, true);
test.done(); test.done();
}); });