diff --git a/packages/ui-app/src/InputNumber.spec.js b/packages/ui-app/src/InputNumber.spec.js index a406b6a9c9..14f0402444 100644 --- a/packages/ui-app/src/InputNumber.spec.js +++ b/packages/ui-app/src/InputNumber.spec.js @@ -87,10 +87,16 @@ describe('InputNumber', () => { it('throws an error if input value for comparison is not a string', () => { const invalidInputValueType = 340282366920938463463374607431768211456; - expect(() => { wrapper.instance().isValidNumber(invalidInputValueType, '0', DEFAULT_BITLENGTH); }).toThrow(); + expect(() => { wrapper.instance().isValidNumber(invalidInputValueType, DEFAULT_BITLENGTH); }).toThrow(); }); }); + it('should not be valid when input contains spaces', () => { + const invalidInputValueType = '3 4'; + + expect(wrapper.instance().isValidNumber(invalidInputValueType, DEFAULT_BITLENGTH)).toBe(false); + }); + it('should not be valid when user enters positive value greater than or equal to the 128 bit max for latest chain', () => { expect(wrapper.instance().isValidNumber(max128BN.toString(10), DEFAULT_BITLENGTH)).toBe(false); }); diff --git a/packages/ui-app/src/InputNumber.tsx b/packages/ui-app/src/InputNumber.tsx index 2c977990c6..b3f545e689 100644 --- a/packages/ui-app/src/InputNumber.tsx +++ b/packages/ui-app/src/InputNumber.tsx @@ -126,9 +126,6 @@ class InputNumber extends React.PureComponent { })); } - // remove spaces even though not possible as user restricted from entering spacebar key in onKeyDown - input = input.toLowerCase().split(' ').join(''); - if (this.isNonInteger(input)) { return false; }