@@ -5,7 +5,7 @@ import { DateInput, Form } from '../../src';
55
66const stories = storiesOf ( 'FormElementBehaviour: DateInput' , module ) ;
77
8- stories . add ( 'Standard' , ( ) => (
8+ stories . add ( 'Standard' , ( ) => (
99 < div style = { { padding : 20 } } >
1010 < h2 > Scenario: onChange and onInput handlers are bound without any other props</ h2 >
1111 < h5 > Expected Behaviour</ h5 >
@@ -15,12 +15,12 @@ stories.add('Standard', () => (
1515 </ ul >
1616 < h5 > Component</ h5 >
1717 < Form >
18- < DateInput onChange = { e => console . log ( e . target . value ) } hint = "Test hint" label = "Test label" />
18+ < DateInput onChange = { e => console . log ( e . target . value ) } hint = "Test hint" label = "Test label" />
1919 </ Form >
2020 </ div >
2121) ) ;
2222
23- stories . add ( 'Standard with Error' , ( ) => (
23+ stories . add ( 'Standard with Error' , ( ) => (
2424 < div style = { { padding : 20 } } >
2525 < h2 > Scenario: onChange and onInput handlers are bound without any other props</ h2 >
2626 < h5 > Expected Behaviour</ h5 >
@@ -29,16 +29,35 @@ stories.add('Standard with Error', () => (
2929 < li > The value is passed through</ li >
3030 </ ul >
3131 < h5 > Component</ h5 >
32- < Form error = { true } >
33- < DateInput onChange = { e => console . log ( e . target . value ) } error = "Test Error" hint = "Test hint" label = "Test label" />
32+ < Form error >
33+ < DateInput onChange = { e => console . log ( e . target . value ) } error = "Test Error" hint = "Test hint" label = "Test label" />
3434 </ Form >
3535 < h5 > Component with specific field errors</ h5 >
36- < Form error = { true } >
36+ < Form error >
3737 < DateInput onChange = { e => console . log ( e . target . value ) } error = "Test Error" hint = "Test hint" label = "Test label" >
38- < DateInput . Day error = { false } />
39- < DateInput . Month />
40- < DateInput . Year />
38+ < DateInput . Day error = { false } />
39+ < DateInput . Month />
40+ < DateInput . Year />
4141 </ DateInput >
4242 </ Form >
4343 </ div >
4444) ) ;
45+
46+ stories . add ( 'Pre-populated' , ( ) => {
47+ const initialValue = { day : '20' , month : '09' , year : '1996' } ;
48+ return (
49+ < div style = { { padding : 20 } } >
50+ < h5 > Component</ h5 >
51+ < Form >
52+ < DateInput
53+ hint = "Test hint"
54+ label = "Test label"
55+ >
56+ < DateInput . Day value = { initialValue . day } />
57+ < DateInput . Month value = { initialValue . month } />
58+ < DateInput . Year value = { initialValue . year } />
59+ </ DateInput >
60+ </ Form >
61+ </ div >
62+ ) ;
63+ } ) ;
0 commit comments