Skip to content

Commit

Permalink
fix #329 - Allow uncontrolled Select component
Browse files Browse the repository at this point in the history
  • Loading branch information
John Benavides committed May 28, 2021
1 parent e1416f4 commit 8201eca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
Expand Up @@ -6,7 +6,6 @@ exports[`Select component Should be focused 1`] = `
>
<select
className="is-focused"
value=""
>
<option>
1
Expand All @@ -27,7 +26,6 @@ exports[`Select component Should be hovered 1`] = `
>
<select
className="is-hovered"
value=""
>
<option>
1
Expand All @@ -49,7 +47,6 @@ exports[`Select component Should be large, red, disabled and multioption 1`] = `
<select
disabled={true}
multiple={true}
value={Array []}
>
<option>
1
Expand All @@ -68,9 +65,7 @@ exports[`Select component Should be loading 1`] = `
<div
className="select is-loading"
>
<select
value=""
>
<select>
<option>
1
</option>
Expand All @@ -88,9 +83,7 @@ exports[`Select component Should be rounded 1`] = `
<div
className="select is-rounded"
>
<select
value=""
>
<select>
<option>
1
</option>
Expand All @@ -108,9 +101,7 @@ exports[`Select component Should concat classname in props with Bulma classname
<div
className="select other-class this-is-a-test"
>
<select
value=""
>
<select>
<option>
1
</option>
Expand All @@ -130,9 +121,7 @@ exports[`Select component Should have select classname 1`] = `
<div
className="select"
>
<select
value=""
>
<select>
<option>
1
</option>
Expand All @@ -155,9 +144,7 @@ exports[`Select component Should use inline styles 1`] = `
}
}
>
<select
value=""
>
<select>
<option>
1
</option>
Expand Down
6 changes: 1 addition & 5 deletions src/components/form/components/select.js
Expand Up @@ -22,10 +22,6 @@ const Select = ({
domRef,
...props
}) => {
/**
* Return default value for value prop
*/
const defaultValue = multiple ? [] : '';
const context = useFieldContext();
const calculatedSize = size || context.size;

Expand All @@ -47,7 +43,7 @@ const Select = ({
[`is-${normalizeStatus(status)}`]: status,
})}
multiple={multiple}
value={value !== undefined ? value : defaultValue}
value={value}
disabled={disabled}
name={name}
>
Expand Down

0 comments on commit 8201eca

Please sign in to comment.