mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:38:13 +00:00
fix(percent): percent failed to input 0 (#2769)
* fix: percent failed to input 0 * fix: percent failed to input 0
This commit is contained in:
parent
c923dfafed
commit
9c29ae9ed8
@ -12,10 +12,11 @@ export const Percent = connect(
|
||||
<InputNumber
|
||||
{...props}
|
||||
addonAfter="%"
|
||||
value={value ? math.round(value * 100, 9) : null}
|
||||
defaultValue={value ? math.round(value * 100, 9) : null}
|
||||
min={0}
|
||||
onChange={(v: any) => {
|
||||
if (onChange) {
|
||||
onChange(v ? math.round(v / 100, 9) : null);
|
||||
onChange(v);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
@ -8,6 +8,5 @@ describe('Percent', () => {
|
||||
const input = container.querySelector('input') as HTMLInputElement;
|
||||
fireEvent.change(input, { target: { value: '10' } });
|
||||
expect(input.value).toBe('10');
|
||||
expect(screen.getByText('10')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user