@@ -195,6 +195,51 @@ describe('datetimepicker', function() {
195
195
expect ( timepicker . timezone_select . val ( ) ) . toBe ( timezoneOffset ) ;
196
196
} ) ;
197
197
} ) ;
198
+
199
+ describe ( 'splitDateTime' , function ( ) {
200
+ var expectedDateString = '3/6/1967' ,
201
+ expectedTimeString = '07:32' ;
202
+
203
+ it ( 'splits a date and time into its parts using the default separator' , function ( ) {
204
+ var inputDateTimeString = expectedDateString + $ . timepicker . _defaults . separator + expectedTimeString ,
205
+ result ;
206
+
207
+ result = $ . timepicker . _util . _splitDateTime ( '' , inputDateTimeString , { } , { } ) ;
208
+
209
+ expect ( result ) . toEqual ( [ expectedDateString , expectedTimeString ] ) ;
210
+ } ) ;
211
+
212
+ it ( 'splits a date and time into its parts using a supplied separator' , function ( ) {
213
+ var separator = '-' ,
214
+ inputDateTimeString = expectedDateString + separator + expectedTimeString ,
215
+ result ;
216
+
217
+ result = $ . timepicker . _util . _splitDateTime ( '' , inputDateTimeString , { } , { separator : separator } ) ;
218
+
219
+ expect ( result ) . toEqual ( [ expectedDateString , expectedTimeString ] ) ;
220
+ } ) ;
221
+
222
+ it ( 'splits a date and time into its parts when there are multiple separators in the time format' , function ( ) {
223
+ var timeFormat = 'hh mm tt' ,
224
+ separator = ' ' ,
225
+ alternateTimeString = '07 32 am' ,
226
+ inputDateTimeString = expectedDateString + separator + alternateTimeString ,
227
+ timeSettings = { separator : separator , timeFormat : timeFormat } ,
228
+ result ;
229
+
230
+ result = $ . timepicker . _util . _splitDateTime ( '' , inputDateTimeString , { } , timeSettings ) ;
231
+
232
+ expect ( result ) . toEqual ( [ expectedDateString , alternateTimeString ] ) ;
233
+ } ) ;
234
+
235
+ it ( 'splits only a date into itself' , function ( ) {
236
+ var result = $ . timepicker . _util . _splitDateTime ( '' , expectedDateString , { } , { } ) ;
237
+
238
+ expect ( result ) . toEqual ( [ expectedDateString , '' ] ) ;
239
+ } ) ;
240
+
241
+ // TODO: Should test the error path, but not sure what throws the error or what the message looks like.
242
+ } ) ;
198
243
} ) ;
199
244
200
245
describe ( 'timepicker functions' , function ( ) {
0 commit comments