diff --git a/jest.config.ts b/jest.config.ts index a81b4f1e..5328c18e 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,16 +1,3 @@ -import { createConfig, type Config } from '@umijs/test'; - -const defaultConfig = createConfig({ - target: 'browser', - jsTransformer: 'swc' -}); - -const config: Config.InitialOptions = { - ...defaultConfig, - setupFiles: [ - ...defaultConfig.setupFiles, - './tests/setup.js' - ] +module.exports = { + setupFiles: ['./tests/setup.js'], }; - -export default config; diff --git a/package.json b/package.json index 0cf307c3..39073d39 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ ] }, "dependencies": { - "@rc-component/mini-decimal": "^1.0.1", + "@rc-component/mini-decimal": "^1.1.1", "@rc-component/util": "^1.4.0", "clsx": "^2.1.1" }, diff --git a/tests/decimal.test.tsx b/tests/decimal.test.tsx index 750444f7..d3f1eb23 100644 --- a/tests/decimal.test.tsx +++ b/tests/decimal.test.tsx @@ -64,6 +64,15 @@ describe('InputNumber.Decimal', () => { expect(container.querySelector('input').value).toEqual('0.1'); }); + it('should not crash when scientific notation precision exceeds native toFixed limit', () => { + const expectedValue = `0.${'0'.repeat(306)}1`; + + expect(() => { + const { container } = render(); + expect(container.querySelector('input').value).toEqual(expectedValue); + }).not.toThrow(); + }); + it('custom decimal separator', () => { const onChange = jest.fn(); const { container } = render();