Skip to content

Commit

Permalink
Merge pull request #427 from kiwicom/fix/select-placeholder
Browse files Browse the repository at this point in the history
FIX: Select placeholder - selected attribute
  • Loading branch information
tomashapl authored Oct 16, 2018
2 parents 500489b + 006c29f commit 1dfbd05
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 24 deletions.
10 changes: 4 additions & 6 deletions src/InputGroup/__snapshots__/InputGroup.stories.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ exports[`Storyshots InputGroup Date of birth 1`] = `
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
value={undefined}
value=""
>
<option
disabled={true}
label="Month"
selected={true}
value=""
>
Month
Expand Down Expand Up @@ -1196,7 +1194,7 @@ exports[`Storyshots InputGroup Phone number 1`] = `
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -2061,7 +2059,7 @@ exports[`Storyshots InputGroup Playground 1`] = `
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -2140,7 +2138,7 @@ exports[`Storyshots InputGroup Playground 1`] = `
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down
2 changes: 2 additions & 0 deletions src/Select/Select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ storiesOf("Select", module)
disabled={disabled}
label={text("Label")}
onChange={action("onChange")}
onBlur={action("onBlur")}
onFocus={action("onFocus")}
dataTest={dataTest}
value={value}
/>
Expand Down
86 changes: 72 additions & 14 deletions src/Select/__snapshots__/Select.stories.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ exports[`Storyshots Select Default 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -573,15 +573,13 @@ exports[`Storyshots Select Playground 1`] = `
<select
className="Select__StyledSelect-eyhbyk ghRKpg"
disabled={false}
onBlur={undefined}
onBlur={[Function]}
onChange={[Function]}
onFocus={undefined}
value={undefined}
onFocus={[Function]}
value=""
>
<option
disabled={true}
label="Select value from list"
selected={true}
value=""
>
Select value from list
Expand Down Expand Up @@ -1043,6 +1041,68 @@ exports[`Storyshots Select Playground 1`] = `
</span>
</span>
</span>
<span>
<span>
<br />

</span>
<span
style={Object {}}
>
onBlur
</span>
<span>
=
<span
style={Object {}}
>
<span>
{
<span
style={
Object {
"color": "#170",
}
}
>
onBlur()
</span>
}
</span>
</span>
</span>
</span>
<span>
<span>
<br />

</span>
<span
style={Object {}}
>
onFocus
</span>
<span>
=
<span
style={Object {}}
>
<span>
{
<span
style={
Object {
"color": "#170",
}
}
>
onFocus()
</span>
}
</span>
</span>
</span>
</span>
<span>
<span>
<br />
Expand Down Expand Up @@ -1258,7 +1318,7 @@ exports[`Storyshots Select With CountryFlag prefix 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -1798,7 +1858,7 @@ exports[`Storyshots Select With error message 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -2346,7 +2406,7 @@ exports[`Storyshots Select With help message 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -2891,12 +2951,10 @@ exports[`Storyshots Select With placeholder 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={true}
label="Select value from list"
selected={true}
value=""
>
Select value from list
Expand Down Expand Up @@ -3452,7 +3510,7 @@ exports[`Storyshots Select With prefix 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down Expand Up @@ -3992,7 +4050,7 @@ exports[`Storyshots Select With small size 1`] = `
onBlur={undefined}
onChange={[Function]}
onFocus={undefined}
value={undefined}
value=""
>
<option
disabled={undefined}
Expand Down
2 changes: 0 additions & 2 deletions src/Select/__tests__/__snapshots__/Select.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,7 @@ exports[`Select should match snapshot 1`] = `
value="1"
>
<option
disabled={true}
label="Default placeholder"
selected={true}
value=""
>
Default placeholder
Expand Down
4 changes: 2 additions & 2 deletions src/Select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ const Select = ({
size={size}
disabled={disabled}
error={error}
value={value}
value={value || ""}
prefix={prefix}
onFocus={onFocus}
onBlur={onBlur}
onChange={onChange}
filled={filled}
>
{placeholder && (
<option label={placeholder} value="" selected disabled>
<option label={placeholder} value="">
{placeholder}
</option>
)}
Expand Down

0 comments on commit 1dfbd05

Please sign in to comment.