diff options
author | Stephen Vance <steve@vance.com> | 2013-07-14 19:03:39 -0400 |
---|---|---|
committer | Stephen Vance <steve@vance.com> | 2013-07-14 19:03:39 -0400 |
commit | ea7babe23eda7cfdca25fa076caaefb8bd3aee6b (patch) | |
tree | 2ed777f2e96eb55f5608274104783cdcf13f5b4f /test | |
parent | 11a2545cfe0b490490b6917c7968504bdefe1926 (diff) | |
download | jQuery-Timepicker-Addon-ea7babe23eda7cfdca25fa076caaefb8bd3aee6b.zip jQuery-Timepicker-Addon-ea7babe23eda7cfdca25fa076caaefb8bd3aee6b.tar.gz jQuery-Timepicker-Addon-ea7babe23eda7cfdca25fa076caaefb8bd3aee6b.tar.bz2 |
Write direct tests for the new computeEffectiveSetting() function. Leave the corresponding variants of splitDateTime() because it still exercises other important facets of the algorithm.
Diffstat (limited to 'test')
-rw-r--r-- | test/jquery-ui-timepicker-addon_spec.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/jquery-ui-timepicker-addon_spec.js b/test/jquery-ui-timepicker-addon_spec.js index 3cd4554..3ddd7b6 100644 --- a/test/jquery-ui-timepicker-addon_spec.js +++ b/test/jquery-ui-timepicker-addon_spec.js @@ -196,6 +196,32 @@ describe('datetimepicker', function() { }); }); + describe('computeEffectiveSetting', function() { + it('pulls the setting from the passed settings object if it is there', function() { + var expectedUniqueValue = 'This is very unique', + settings = { + property: expectedUniqueValue + }; + + expect($.timepicker._util._computeEffectiveSetting(settings, 'property')).toBe(expectedUniqueValue); + }); + + it('pulls the setting from the timepicker defaults if there are no passed settings', function() { + var expectedValue = $.timepicker._defaults.separator; + expect(expectedValue).toBeDefined(); + + expect($.timepicker._util._computeEffectiveSetting(undefined, 'separator')).toBe(expectedValue); + }); + + it('pulls the setting from the timepicker defaults if not present in the passed settings', function() { + var expectedValue = $.timepicker._defaults.separator, + settings = {}; + expect(expectedValue).toBeDefined(); + + expect($.timepicker._util._computeEffectiveSetting(settings, 'separator')).toBe(expectedValue); + }); + }); + describe('splitDateTime', function() { var expectedDateString = '3/6/1967', expectedTimeString = '07:32'; |