Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions tests/decimal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ describe('InputNumber.Decimal', () => {
expect(container.querySelector('input').value).toEqual('0.1');
});

it('should not crash when scientific notation precision exceeds native toFixed limit', () => {
expect(() => render(<InputNumber defaultValue={1e-307} />)).not.toThrow();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current test correctly verifies that rendering does not crash. However, it could be strengthened by also asserting that a value is actually rendered in the input. This would prevent future regressions where the component might fail silently (e.g., by rendering an empty string) instead of crashing. The suggested change implicitly keeps the crash check, as render would throw an exception and fail the test if it crashed.

    const { container } = render(<InputNumber defaultValue={1e-307} />);
    expect(container.querySelector('input').value).not.toBe('');

});

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