Skip to content

Commit bb7e010

Browse files
committed
Refactor the dateFormat in the parseDateTimeInternal tests.
1 parent f50fc08 commit bb7e010

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/jquery-ui-timepicker-addon_spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ describe('datetimepicker', function() {
266266
});
267267

268268
describe('parseDateTimeInternal', function() {
269+
var dateFormat = 'mm/dd/yy';
270+
269271
it('should return only a date if there is no time component', function() {
270272
var inputDateString = '9/11/2001',
271273
expectedDate = new Date(inputDateString),
272274
result;
273275

274-
result = $.timepicker._util._parseDateTimeInternal('mm/dd/yy', undefined, inputDateString, undefined, undefined);
276+
result = $.timepicker._util._parseDateTimeInternal(dateFormat, undefined, inputDateString, undefined, undefined);
275277

276278
expect(result.date).toEqual(expectedDate);
277279
expect(result.timeObj).toBeUndefined();
@@ -294,7 +296,7 @@ describe('datetimepicker', function() {
294296
expectedDate = new Date(expectedDateString),
295297
result;
296298

297-
result = $.timepicker._util._parseDateTimeInternal('mm/dd/yy', 'H:m:s.l', inputDateTimeString, undefined, undefined);
299+
result = $.timepicker._util._parseDateTimeInternal(dateFormat, 'H:m:s.l', inputDateTimeString, undefined, undefined);
298300

299301
expect(result.date).toEqual(expectedDate);
300302
expect(result.timeObj).toEqual(expectedParsedTime);
@@ -304,7 +306,7 @@ describe('datetimepicker', function() {
304306
var inputDateString = '4/17/2008 11:22:33';
305307

306308
expect(function() {
307-
$.timepicker._util._parseDateTimeInternal('mm/dd/yy', 'q', inputDateString, undefined, undefined);
309+
$.timepicker._util._parseDateTimeInternal(dateFormat, 'q', inputDateString, undefined, undefined);
308310
}).toThrow('Wrong time format');
309311
});
310312
});

0 commit comments

Comments
 (0)