Added test for rendering elements with PureRenderMixin and Formsy.Mixin
This commit is contained in:
parent
8636cdabc3
commit
59bde8324c
|
|
@ -34,6 +34,7 @@
|
|||
"lolex": "^1.3.2",
|
||||
"nodeunit": "^0.9.1",
|
||||
"react": "^0.14.0-rc1",
|
||||
"react-addons-pure-render-mixin": "^0.14.2",
|
||||
"react-addons-test-utils": "^0.14.0-rc1",
|
||||
"react-dom": "^0.14.0-rc1",
|
||||
"sinon": "^1.17.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import React from 'react';
|
||||
import TestUtils from 'react-addons-test-utils';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import Formsy from './..';
|
||||
import TestInput, { InputFactory } from './utils/TestInput';
|
||||
|
|
@ -537,6 +539,30 @@ export default {
|
|||
|
||||
test.done();
|
||||
|
||||
},
|
||||
|
||||
'input should rendered once with PureRenderMixin': function (test) {
|
||||
|
||||
var renderSpy = sinon.spy();
|
||||
|
||||
const Input = InputFactory({
|
||||
mixins: [Formsy.Mixin, PureRenderMixin],
|
||||
render() {
|
||||
renderSpy();
|
||||
return <input type={this.props.type} value={this.getValue()} onChange={this.updateValue}/>;
|
||||
}
|
||||
});
|
||||
|
||||
const form = TestUtils.renderIntoDocument(
|
||||
<Formsy.Form>
|
||||
<Input name="foo" value="foo"/>
|
||||
</Formsy.Form>
|
||||
);
|
||||
|
||||
test.equal(renderSpy.calledOnce, true);
|
||||
|
||||
test.done();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue