aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/datepicker/datepicker_options.js
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2009-04-01 10:15:29 +0000
committerKeith Wood <kbwood.au@gmail.com>2009-04-01 10:15:29 +0000
commita6c705420b7878dbf6b540be128485952ff26440 (patch)
treea83c165d3bd7dab3a1ace550c226de75505ce7fa /tests/unit/datepicker/datepicker_options.js
parent4d5f8d4ae07826aa6e118e2c6b2ef81ae00d57ff (diff)
downloadjquery-ui-a6c705420b7878dbf6b540be128485952ff26440.tar.gz
jquery-ui-a6c705420b7878dbf6b540be128485952ff26440.zip
Datepicker: Corrected unit tests for structural changes and end of month
Diffstat (limited to 'tests/unit/datepicker/datepicker_options.js')
-rw-r--r--tests/unit/datepicker/datepicker_options.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 412519a4b..882a72b22 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -187,13 +187,12 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
- date = new Date();
- date.setMonth(date.getMonth() - 1);
+ date = addMonths(new Date(), -1);
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
inp.datepicker('option', {defaultDate: '+2M'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
- date.setMonth(date.getMonth() + 3);
+ date = addMonths(new Date(), 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show').
@@ -209,8 +208,7 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
- date = new Date();
- date.setMonth(date.getMonth() + 1);
+ date = addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
date = new Date(2007, 1 - 1, 26);
@@ -245,7 +243,8 @@ test('miscellaneous', function() {
equals(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default');
equals(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default');
equals(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default');
- inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).val('02/04/2008').datepicker('show');
+ inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).
+ val('02/04/2008').datepicker('show');
var longNames = $.datepicker.regional[''].monthNames;
var shortNames = $.datepicker.regional[''].monthNamesShort;
var date = new Date();
@@ -329,8 +328,7 @@ test('minMax', function() {
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
- date = new Date();
- date.setMonth(date.getMonth() + 1);
+ date = addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
inp.val('').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).