Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await waitForDom(() => {
const input = select('NATIVE_INPUT_NUMBER');
simulate.keyDown(input, {keyCode: KeyCodes.up});
assertCommit(input, onChange, max);
});
});
await waitForDom(() => {
const input = select('NATIVE_INPUT_NUMBER');
simulate.keyDown(input, {keyCode: KeyCodes.up});
assertCommit(input, onChange, value + step);
});
});
public pressUpKey(opts?: Modifiers) {
simulate.keyDown(this.nativeInput, {keyCode: KeyCodes.up, ...opts});
}
private handleInputKeyDown: React.KeyboardEventHandler = e => {
switch (e.keyCode) {
case KeyCodes.up:
this.stepValue(Direction.Increase, e.shiftKey ? 10 : 1);
e.preventDefault();
break;
case KeyCodes.down:
this.stepValue(Direction.Decrease, e.shiftKey ? 10 : 1);
e.preventDefault();
break;
case KeyCodes.enter:
this.commit(this.state.value);
e.preventDefault();
break;
case KeyCodes.esc:
this.revert();
e.preventDefault();
break;
}