-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
Hey @vlad-ignatov using react-numeric-input control has helped me a lot and serving my purpose. Now its time for some unit testing react-numeric-input with my project..
Some how the test cases you provided taking them as reference i can't simulate key-up/down/change events. Is their any best way to do it or am i making wrong direction. Following is the code.
`it('calls onChange when user press up arrow key', () => {
let onChangeCalls = 0
function onChange(x){
console.log('change function fired');
onChangeCalls += 1;
}
var widget = TestUtils.renderIntoDocument(<MyNumericInput
onChange={ onChange }
/>
)
TestUtils.Simulate.keyDown(widget.refs.numericbox, {
keyCode: KEYCODE_UP,
ctrlKey: true
})
console.log(onChangeCalls);
expect(onChangeCalls).to.equal(1);
});`
Whereas MyNumericInput is my component wrapping react-numeric-input control inside it.
Let me know if you need more information on this..
Metadata
Metadata
Assignees
Labels
No labels