File tree Expand file tree Collapse file tree
packages/eui/src/components/date_picker/super_date_picker/date_popover Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,6 +123,31 @@ describe('EuiAbsoluteTab', () => {
123123 expect ( input ) . toHaveValue ( 'Jan 31st 01' ) ;
124124 } ) ;
125125
126+ it ( 'can be forgiving with `dateFormat`' , ( ) => {
127+ const { getByTestSubject } = render (
128+ < EuiAbsoluteTab
129+ { ...props }
130+ dateFormat = "MMM D, YYYY HH:mm:ss"
131+ locale = "en"
132+ />
133+ ) ;
134+ const input = getByTestSubject (
135+ 'superDatePickerAbsoluteDateInput'
136+ ) as HTMLInputElement ;
137+
138+ changeInput ( input , 'Jan 31, 1993' ) ;
139+ expect ( input ) . not . toBeInvalid ( ) ;
140+ expect ( input ) . toHaveValue ( 'Jan 31, 1993 00:00:00' ) ;
141+
142+ changeInput ( input , 'Jan 31' ) ;
143+ expect ( input ) . not . toBeInvalid ( ) ;
144+ expect ( input . value ) . toContain ( 'Jan 31, ' ) ;
145+
146+ changeInput ( input , 'Jan' ) ;
147+ expect ( input ) . not . toBeInvalid ( ) ;
148+ expect ( input . value ) . toContain ( 'Jan 1, ' ) ;
149+ } ) ;
150+
126151 describe ( 'parses date string in locale' , ( ) => {
127152 test . each < {
128153 locale : LocaleSpecifier ;
You can’t perform that action at this time.
0 commit comments