mirror of
https://github.com/immich-app/immich.git
synced 2025-11-21 21:40:41 +09:00
fix(web): validation of number input fields (#9789)
This commit is contained in:
@@ -27,4 +27,25 @@ describe('SettingInputField component', () => {
|
||||
await user.click(document.body);
|
||||
expect(numberInput.value).toEqual('100');
|
||||
});
|
||||
|
||||
it('allows emptying number inputs while editing', async () => {
|
||||
const { getByRole } = render(SettingInputField, {
|
||||
props: {
|
||||
label: 'test-number-input',
|
||||
inputType: SettingInputFieldType.NUMBER,
|
||||
value: 5,
|
||||
},
|
||||
});
|
||||
const user = userEvent.setup();
|
||||
|
||||
const numberInput = getByRole('spinbutton') as HTMLInputElement;
|
||||
expect(numberInput.value).toEqual('5');
|
||||
|
||||
await user.click(numberInput);
|
||||
await user.keyboard('{Backspace}');
|
||||
expect(numberInput.value).toEqual('');
|
||||
|
||||
await user.click(document.body);
|
||||
expect(numberInput.value).toEqual('0');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user