diff options
author | Stephen Vance <steve@vance.com> | 2013-07-14 21:21:08 -0400 |
---|---|---|
committer | Stephen Vance <steve@vance.com> | 2013-07-14 21:21:08 -0400 |
commit | bb7e010b8e0b6d75015ff06399a59fde37cec654 (patch) | |
tree | ab676fa640de916f398e4fc6a19adc19487a0b33 /test | |
parent | f50fc089557ee509466f9325b81aafc6a28b202e (diff) | |
download | jQuery-Timepicker-Addon-bb7e010b8e0b6d75015ff06399a59fde37cec654.zip jQuery-Timepicker-Addon-bb7e010b8e0b6d75015ff06399a59fde37cec654.tar.gz jQuery-Timepicker-Addon-bb7e010b8e0b6d75015ff06399a59fde37cec654.tar.bz2 |
Refactor the dateFormat in the parseDateTimeInternal tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/jquery-ui-timepicker-addon_spec.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/jquery-ui-timepicker-addon_spec.js b/test/jquery-ui-timepicker-addon_spec.js index 6dfda55..5e9b58b 100644 --- a/test/jquery-ui-timepicker-addon_spec.js +++ b/test/jquery-ui-timepicker-addon_spec.js @@ -266,12 +266,14 @@ describe('datetimepicker', function() { }); describe('parseDateTimeInternal', function() { + var dateFormat = 'mm/dd/yy'; + it('should return only a date if there is no time component', function() { var inputDateString = '9/11/2001', expectedDate = new Date(inputDateString), result; - result = $.timepicker._util._parseDateTimeInternal('mm/dd/yy', undefined, inputDateString, undefined, undefined); + result = $.timepicker._util._parseDateTimeInternal(dateFormat, undefined, inputDateString, undefined, undefined); expect(result.date).toEqual(expectedDate); expect(result.timeObj).toBeUndefined(); @@ -294,7 +296,7 @@ describe('datetimepicker', function() { expectedDate = new Date(expectedDateString), result; - result = $.timepicker._util._parseDateTimeInternal('mm/dd/yy', 'H:m:s.l', inputDateTimeString, undefined, undefined); + result = $.timepicker._util._parseDateTimeInternal(dateFormat, 'H:m:s.l', inputDateTimeString, undefined, undefined); expect(result.date).toEqual(expectedDate); expect(result.timeObj).toEqual(expectedParsedTime); @@ -304,7 +306,7 @@ describe('datetimepicker', function() { var inputDateString = '4/17/2008 11:22:33'; expect(function() { - $.timepicker._util._parseDateTimeInternal('mm/dd/yy', 'q', inputDateString, undefined, undefined); + $.timepicker._util._parseDateTimeInternal(dateFormat, 'q', inputDateString, undefined, undefined); }).toThrow('Wrong time format'); }); }); |