Closed daniele-zurico closed 7 months ago
If I pass the default value when I change the value from the drop-down list it stays on the default value:
function FormSelectDemo() { const [value, setValue] = React.useState('') const handleChange = event => { setValue(event.currentTarget.value); } return ( <FormSelect id="select" disabled={false} value={value} defaultValue="option3" onChange={handleChange} options={['option1','option2', 'option3']} /> ); }
Write the following test to check if your change is correct:
it('should allow to change the default value on select', async () => { const user = userEvent.setup(); render( <FormSelect options={['first', 'second', 'third']} defaultValue="third" /> ); await user.selectOptions(screen.getByRole('combobox'), 'first'); const option: any = screen.getByRole('option', { name: 'first' }); expect(option.selected).toBe(true); });
Follow this to create the new branch:
git checkout release/1.0.0 git pull git checkout -b 'fix/select-default'
closed by #573
If I pass the default value when I change the value from the drop-down list it stays on the default value:
Write the following test to check if your change is correct:
Follow this to create the new branch: