Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
setupFiles: ['./tests/setup.js'],
};
16 changes: 0 additions & 16 deletions jest.config.ts

This file was deleted.

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