aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/datepicker/datepicker_options.js
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2009-06-16 08:44:56 +0000
committerKeith Wood <kbwood.au@gmail.com>2009-06-16 08:44:56 +0000
commitf07a17bbf0e10190ae742dd8021550a7c57c082e (patch)
treea1e8a2eaea39ae507c3cafa13f78f3781628c52e /tests/unit/datepicker/datepicker_options.js
parent37f4f744935f0181aa23253b2e9f2f2251bcbb0c (diff)
downloadjquery-ui-f07a17bbf0e10190ae742dd8021550a7c57c082e.tar.gz
jquery-ui-f07a17bbf0e10190ae742dd8021550a7c57c082e.zip
Datepicker: default, min, and max dates can be specified as date strings in the current format
Diffstat (limited to 'tests/unit/datepicker/datepicker_options.js')
-rw-r--r--tests/unit/datepicker/datepicker_options.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 52841468d..8bde84473 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -142,7 +142,7 @@ test('defaultDate', function() {
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
- // numeric values
+ // Numeric values
inp.datepicker('option', {defaultDate: -2}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
@@ -162,7 +162,7 @@ test('defaultDate', function() {
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Default date NaN');
- // string values
+ // String offset values
inp.datepicker('option', {defaultDate: '-1d'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
@@ -211,8 +211,20 @@ test('defaultDate', function() {
date = addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
+ // String date values
+ inp.datepicker('option', {defaultDate: '07/04/2007'}).
+ datepicker('hide').val('').datepicker('show').
+ simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ date = new Date(2007, 7 - 1, 4);
+ equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007');
+ inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}).
+ datepicker('hide').val('').datepicker('show').
+ simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ date = new Date(2007, 4 - 1, 2);
+ equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02');
+ // Date value
date = new Date(2007, 1 - 1, 26);
- inp.datepicker('option', {defaultDate: date}).
+ inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007');