diff options
author | Keith Wood <kbwood.au@gmail.com> | 2009-12-01 01:27:25 +0000 |
---|---|---|
committer | Keith Wood <kbwood.au@gmail.com> | 2009-12-01 01:27:25 +0000 |
commit | d33c2de502b124bfe5067c677878b96f906cd1bd (patch) | |
tree | 03465f89cae4155a0d25fa79b6b2b401d874419a /tests/unit | |
parent | fe217c4745fb73516e0835f3c4c195304ad6b43d (diff) | |
download | jquery-ui-d33c2de502b124bfe5067c677878b96f906cd1bd.tar.gz jquery-ui-d33c2de502b124bfe5067c677878b96f906cd1bd.zip |
Datepicker - Fixed #4870 - yearRange doesn't work as expected
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/datepicker/datepicker_options.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 8a716144b..5bdf415e0 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -267,14 +267,21 @@ test('miscellaneous', function() { } return range; }; + var curYear = new Date().getFullYear(); inp.val('02/04/2008').datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); - inp.datepicker('hide').datepicker('option', {yearRange: '-6:+2', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - -6:+2'); + inp.datepicker('hide').datepicker('option', {yearRange: 'c-6:c+2', changeYear: true}).datepicker('show'); + equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); inp.datepicker('hide').datepicker('option', {yearRange: '2000:2010', changeYear: true}).datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010'); + inp.datepicker('hide').datepicker('option', {yearRange: '-5:+3', changeYear: true}).datepicker('show'); + equals(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3'); + inp.datepicker('hide').datepicker('option', {yearRange: '2000:-5', changeYear: true}).datepicker('show'); + equals(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5'); + inp.datepicker('hide').datepicker('option', {yearRange: '', changeYear: true}).datepicker('show'); + equals(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2'); // Navigation as date format inp.datepicker('option', {showButtonPanel: true}); |