Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
9 changes: 9 additions & 0 deletions tests/decimal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<InputNumber defaultValue={1e-307} />);
expect(container.querySelector('input').value).toEqual(expectedValue);
}).not.toThrow();
});

it('custom decimal separator', () => {
const onChange = jest.fn();
const { container } = render(<InputNumber decimalSeparator="," onChange={onChange} />);
Expand Down
Loading