@@ -6,25 +6,26 @@ import { action } from '@storybook/addon-actions'
66
77const StaticInput = ( props ) => < input { ...props } />
88const Input = dynamicInput ( ) ( StaticInput )
9+ const inputName = 'inputName'
910
1011storiesOf ( 'LabeledField' , module )
1112 . add ( 'default' , ( ) => (
1213 < LabeledField
1314 { ...{
1415 input : {
15- name : 'input name' ,
16+ name : inputName ,
1617 } ,
1718 meta : { } ,
1819 } }
1920 >
20- < Input />
21+ < Input id = { inputName } />
2122 </ LabeledField >
2223 ) )
2324 . add ( 'with error' , ( ) => (
2425 < LabeledField
2526 { ...{
2627 input : {
27- name : 'input name' ,
28+ name : inputName ,
2829 } ,
2930 meta : {
3031 touched : true ,
@@ -33,14 +34,14 @@ storiesOf('LabeledField', module)
3334 } ,
3435 } }
3536 >
36- < Input />
37+ < Input id = { inputName } />
3738 </ LabeledField >
3839 ) )
3940 . add ( 'hide error' , ( ) => (
4041 < LabeledField
4142 { ...{
4243 input : {
43- name : 'input name' ,
44+ name : inputName ,
4445 } ,
4546 meta : {
4647 touched : true ,
@@ -50,28 +51,28 @@ storiesOf('LabeledField', module)
5051 hideErrorLabel : true ,
5152 } }
5253 >
53- < Input />
54+ < Input id = { inputName } />
5455 </ LabeledField >
5556 ) )
5657 . add ( 'with custom label' , ( ) => {
5758 // eslint-disable-next-line
5859 const CustomLabel = ( { onClickLabel } ) => (
59- < label onClick = { onClickLabel } htmlFor = " inputName" >
60+ < label onClick = { onClickLabel } htmlFor = { inputName } >
6061 This is a < b > custom</ b > label
6162 </ label >
6263 )
6364 return (
6465 < LabeledField
6566 { ...{
6667 input : {
67- name : ' inputName' ,
68+ name : inputName ,
6869 } ,
6970 meta : { } ,
7071 labelComponent : CustomLabel ,
7172 onClickLabel : action ( 'Custom Label Clicked' ) ,
7273 } }
7374 >
74- < Input id = " inputName" />
75+ < Input id = { inputName } />
7576 </ LabeledField >
7677 )
7778 } )
@@ -86,7 +87,7 @@ storiesOf('LabeledField', module)
8687 < LabeledField
8788 { ...{
8889 input : {
89- name : ' inputName' ,
90+ name : inputName ,
9091 } ,
9192 meta : {
9293 touched : true ,
@@ -96,7 +97,7 @@ storiesOf('LabeledField', module)
9697 errorComponent : CustomError ,
9798 } }
9899 >
99- < Input id = " inputName" aria-describedby = "inputError" />
100+ < Input id = { inputName } aria-describedby = "inputError" />
100101 </ LabeledField >
101102 )
102103 } )
0 commit comments