diff --git a/packages/@mantine/core/src/components/NumberInput/NumberInput.test.tsx b/packages/@mantine/core/src/components/NumberInput/NumberInput.test.tsx index 42b3319260a..eab274e29fb 100644 --- a/packages/@mantine/core/src/components/NumberInput/NumberInput.test.tsx +++ b/packages/@mantine/core/src/components/NumberInput/NumberInput.test.tsx @@ -132,4 +132,30 @@ describe('@mantine/core/NumberInput', () => { await enterText('{arrowdown}'); expect(spy).toHaveBeenCalledTimes(2); }); + + it('checks whether the data entered is larger than Number.MAX_SAFE_INT', async () => { + const spy = jest.fn(); + render(); + + focusInput(); + await enterText('{backspace}'); + expect(spy).toHaveBeenLastCalledWith(900719925474099); + expect(spy).toHaveBeenCalledTimes(1); + + await enterText('2'); + expect(spy).toHaveBeenLastCalledWith('9007199254740992'); + expect(spy).toHaveBeenCalledTimes(2); + + await enterText('7'); + expect(spy).toHaveBeenLastCalledWith('90071992547409927'); + expect(spy).toHaveBeenCalledTimes(3); + + await enterText('{backspace}'); + await enterText('{backspace}'); + await enterText('{backspace}'); + await enterText('{backspace}'); + await enterText('{backspace}'); + expect(spy).toHaveBeenLastCalledWith(900719925474); + expect(spy).toHaveBeenCalledTimes(8); + }); });