diff --git a/tests/Element-spec.js b/tests/Element-spec.js index 49b9f018..ad7a0592 100644 --- a/tests/Element-spec.js +++ b/tests/Element-spec.js @@ -607,6 +607,38 @@ export default { }, + 'input should call shouldComponentUpdate with correct value': function (test) { + + var renderSpy = sinon.spy(); + + const Input = InputFactory({ + shouldComponentUpdate: function(prevProps) { + return prevProps.value !== this.props.value + }, + render: function() { + renderSpy(); + return ; + } + }); + + const form = TestUtils.renderIntoDocument( + + + + ); + + const input = TestUtils.findRenderedDOMComponentWithTag(form, 'INPUT'); + + test.equal(renderSpy.calledOnce, true); + + TestUtils.Simulate.change(input, {target: {value: 'fooz'}}); + test.equal(input.value, 'fooz'); + test.equal(renderSpy.calledTwice, true); + + test.done(); + + }, + 'binds all necessary methods': function (test) { const onInputRef = input => { [