]> source.dussan.org Git - jquery-ui.git/commitdiff
Add tests for destroying datepicker, keystrokes, minimum/maximum date processing...
authorKeith Wood <kbwood.au@gmail.com>
Fri, 13 Jun 2008 13:25:59 +0000 (13:25 +0000)
committerKeith Wood <kbwood.au@gmail.com>
Fri, 13 Jun 2008 13:25:59 +0000 (13:25 +0000)
tests/datepicker.js

index d4cc7460620e14f0e2afc4b85dd782019b2fe033..1c7a25f9512b3d07beaad7bde634161061dce2ee 100644 (file)
@@ -10,7 +10,19 @@ function equalsDate(d1, d2, message) {
        equals(d1.toString(), d2.toString(), message);\r
 }\r
 \r
-test('defaults', function() {\r
+function equalsDateArray(a1, a2, message) {\r
+       if (!a1 || !a2) {\r
+               ok(false, message + ' - missing dates');\r
+               return;\r
+       }\r
+       a1[0] = (a1[0] ? new Date(a1[0].getFullYear(), a1[0].getMonth(), a1[0].getDate()) : '');\r
+       a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : '');\r
+       a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : '');\r
+       a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : '');\r
+       equals(serialArray(a1), serialArray(a2), message);\r
+}\r
+\r
+test('setDefaults', function() {\r
        var dp1 = $('#dp1');\r
        dp1.datepicker();\r
        ok(dp1.is('.hasDatepicker'), 'Marker class set');\r
@@ -29,10 +41,20 @@ test('remove', function() {
        var rem = $('#rem');\r
        rem.datepicker();\r
        ok(rem.is('.hasDatepicker'), 'Marker class set');\r
-       ok(rem[0]._calId != null, 'Datepicker ID present');\r
+       ok(rem[0]._calId, 'Datepicker ID present');\r
        rem.datepicker('destroy');\r
+       rem = $('#rem');\r
        ok(!rem.is('.hasDatepicker'), 'Marker class cleared');\r
-       ok(rem[0]._calId == null, 'Datepicker ID absent');\r
+       ok(!rem[0]._calId, 'Datepicker ID absent');\r
+       rem.datepicker({showOn: 'both', buttonImage: 'img/calendar.gif'});\r
+       ok(rem.is('.hasDatepicker'), 'Marker class set');\r
+       ok(rem[0]._calId, 'Datepicker ID present');\r
+       ok(rem.parent('.ui-datepicker-wrap').length != 0, 'Wrapper present');\r
+       rem.datepicker('destroy');\r
+       rem = $('#rem');\r
+       ok(!rem.is('.hasDatepicker'), 'Marker class cleared');\r
+       ok(!rem[0]._calId, 'Datepicker ID absent');\r
+       ok(rem.parent('.ui-datepicker-wrap').length == 0, 'Wrapper absent');\r
 });\r
 \r
 test('change', function() {\r
@@ -65,19 +87,279 @@ test('enableDisable', function() {
        dp1.datepicker('enable');\r
        ok(!dp1.datepicker('isDisabled'), 'Now enabled');\r
 });\r
-/*\r
+\r
 test('keystrokes', function() {\r
        var dp1 = $('#dp1');\r
-       dp1.datepicker().val('').focus();\r
-       dp1.simulate('keydown', {keyCode: 13});\r
-       equalsDate(dp1.datepicker('getDate'), new Date(), 'Select today');\r
-       dp1.blur();\r
+       var date = new Date();\r
+       dp1.datepicker({speed: ''}).val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke enter');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke enter - preset');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke ctrl+home');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});\r
+       ok(dp1.datepicker('getDate') == null, 'Keystroke ctrl+end');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       ok(dp1.datepicker('getDate') == null, 'Keystroke esc');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - preset');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - abandoned');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() - 1);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke ctrl+left');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_LEFT}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() + 1);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke left');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() + 1);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke ctrl+right');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_RIGHT}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() - 1);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke right');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() - 7);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke ctrl+up');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_UP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() + 7);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke up');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() + 7);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke ctrl+down');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() - 7);\r
+       equalsDate(dp1.datepicker('getDate'), date, 'Keystroke down');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 1 - 1, 4), 'Keystroke pgup');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 3 - 1, 4), 'Keystroke pgdn');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2007, 2 - 1, 4), 'Keystroke ctrl+pgup');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2009, 2 - 1, 4), 'Keystroke ctrl+pgdn');\r
+       dp1.val('03/31/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgup - Feb');\r
+       dp1.val('01/30/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgdn - Feb');\r
+       dp1.val('02/29/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2007, 2 - 1, 28), 'Keystroke ctrl+pgup - Feb');\r
+       dp1.val('02/29/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), new Date(2009, 2 - 1, 28), 'Keystroke ctrl+pgdn - Feb');\r
+});\r
+\r
+test('minMax', function() {\r
+       var dp1 = $('#dp1');\r
+       var lastYear = new Date(2007, 6 - 1, 4);\r
+       var nextYear = new Date(2009, 6 - 1, 4);\r
+       var minDate = new Date(2008, 2 - 1, 29);\r
+       var maxDate = new Date(2008, 12 - 1, 7);\r
+       dp1.datepicker({speed: ''}).val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), lastYear, 'Min/max - null, null - ctrl+pgup');\r
+       dp1.val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), nextYear, 'Min/max - null, null - ctrl+pgdn');\r
+       dp1.datepicker('change', {minDate: minDate}).datepicker('hide').val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, null - ctrl+pgup');\r
+       dp1.val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), nextYear, 'Min/max - 02/29/2008, null - ctrl+pgdn');\r
+       dp1.datepicker('change', {maxDate: maxDate}).datepicker('hide').val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup');\r
+       dp1.val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), maxDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn');\r
+       dp1.datepicker('change', {minDate: null}).datepicker('hide').val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), lastYear, 'Min/max - null, 12/07/2008 - ctrl+pgup');\r
+       dp1.val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(dp1.datepicker('getDate'), maxDate, 'Min/max - null, 12/07/2008 - ctrl+pgdn');\r
+});\r
+\r
+test('ranges', function() {\r
+       var dp1 = $('#dp1');\r
+       var d1 = new Date();\r
+       var d2 = new Date();\r
+       dp1.datepicker({speed: '', rangeSelect: true}).val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDateArray(dp1.datepicker('getDate'), [d1, d2], 'Range 1 month - enter/enter');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDateArray(dp1.datepicker('getDate'), [d1, d2], 'Range 1 month - enter/ctrl+up/enter');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       d2.setDate(d2.getDate() + 7);\r
+       equalsDateArray(dp1.datepicker('getDate'), [d1, d2], 'Range 1 month - enter/ctrl+down/enter');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equalsDateArray(dp1.datepicker('getDate'), [d1, d1], 'Range 1 month - enter/ctrl+down/esc');\r
+       // Callbacks\r
+       dp1.datepicker('change', {onSelect: callback}).datepicker('hide').\r
+               val('06/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equals(selectedDate, '06/04/2008 - 06/11/2008', 'Range 1 month onSelect - enter/ctrl+down/enter');\r
+       dp1.datepicker('change', {onChangeMonthYear: callback, onSelect: null}).datepicker('hide').\r
+               val('05/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGUP}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(selectedDate, new Date(2008, 4 - 1, 1), 'Range 1 month onChangeMonthYear - enter/ctrl+down/enter');\r
+       dp1.datepicker('change', {onClose: callback, onChangeMonthYear: null}).datepicker('hide').\r
+               val('03/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER}).\r
+               simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDateArray(selectedDate, [new Date(2008, 3 - 1, 4), new Date(2008, 3 - 1, 11)],\r
+               'Range 1 month onClose - enter/ctrl+down/enter');\r
 });\r
-*/\r
+\r
+var selectedThis = null;\r
+var selectedDate = null;\r
+var selectedInst = null;\r
+\r
+function callback(date, inst) {\r
+       selectedThis = this;\r
+       selectedDate = date;\r
+       selectedInst = inst;\r
+}\r
+\r
+test('callbacks', function() {\r
+       var dp1 = $('#dp1');\r
+       var date = new Date();\r
+       // onSelect\r
+       dp1.datepicker({speed: '', onSelect: callback}).val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equals(selectedThis, dp1[0], 'Callback selected this');\r
+       equals(selectedInst, $.datepicker._getInst(dp1[0]._calId), 'Callback selected inst');\r
+       equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).\r
+               simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       date.setDate(date.getDate() + 7);\r
+       equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - ctrl+down');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - esc');\r
+       // onChangeMonthYear\r
+       dp1.datepicker('change', {onChangeMonthYear: callback, onSelect: null}).\r
+               val('').datepicker('show');\r
+       date = new Date();\r
+       date.setDate(1);\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGUP});\r
+       date.setMonth(date.getMonth() - 1);\r
+       equals(selectedThis, dp1[0], 'Callback change month/year this');\r
+       equals(selectedInst, $.datepicker._getInst(dp1[0]._calId), 'Callback change month/year inst');\r
+       equalsDate(selectedDate, date, 'Callback change month/year date - pgup');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGDN});\r
+       date.setMonth(date.getMonth() + 1);\r
+       equalsDate(selectedDate, date, 'Callback change month/year date - pgdn');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP});\r
+       date.setFullYear(date.getFullYear() - 1);\r
+       equalsDate(selectedDate, date, 'Callback change month/year date - ctrl+pgup');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME});\r
+       date.setFullYear(date.getFullYear() + 1);\r
+       equalsDate(selectedDate, date, 'Callback change month/year date - ctrl+home');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN});\r
+       date.setFullYear(date.getFullYear() + 1);\r
+       equalsDate(selectedDate, date, 'Callback change month/year date - ctrl+pgdn');\r
+       // onChangeMonthYear step by 2\r
+       dp1.datepicker('change', {stepMonths: 2}).datepicker('hide').val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGUP});\r
+       date.setMonth(date.getMonth() - 14);\r
+       equalsDate(selectedDate, date, 'Callback change month/year by 2 date - pgup');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP});\r
+       date.setMonth(date.getMonth() - 12);\r
+       equalsDate(selectedDate, date, 'Callback change month/year by 2 date - ctrl+pgup');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_PGDN});\r
+       date.setMonth(date.getMonth() + 2);\r
+       equalsDate(selectedDate, date, 'Callback change month/year by 2 date - pgdn');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN});\r
+       date.setMonth(date.getMonth() + 12);\r
+       equalsDate(selectedDate, date, 'Callback change month/year by 2 date - ctrl+pgdn');\r
+       // onClose\r
+       dp1.datepicker('change', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).\r
+               val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equals(selectedThis, dp1[0], 'Callback close this');\r
+       equals(selectedInst, $.datepicker._getInst(dp1[0]._calId), 'Callback close inst');\r
+       ok(selectedDate == null, 'Callback close date - esc');\r
+       dp1.val('').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ENTER});\r
+       equalsDate(selectedDate, new Date(), 'Callback close date - enter');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {keyCode: $.simulate.VK_ESC});\r
+       equalsDate(selectedDate, new Date(2008, 2 - 1, 4), 'Callback close date - preset');\r
+       dp1.val('02/04/2008').datepicker('show');\r
+       dp1.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});\r
+       ok(selectedDate == null, 'Callback close date - ctrl+end');\r
+});\r
+\r
 test('noWeekends', function() {\r
        for (var i = 1; i <= 31; i++) {\r
                var date = new Date(2001, 1 - 1, i);\r
-               isObj($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],\r
+               isSet($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],\r
                        'No weekends ' + date);\r
        }\r
 });\r
@@ -127,6 +409,14 @@ test('parseDate', function() {
                new Date(2001, 2 - 1, 3), 'Parse date DD, MM d, yy');\r
        equalsDate($.datepicker.parseDate('\'day\' d of MM (\'\'DD\'\'), yy', 'day 3 of February (\'Saturday\'), 2001'),\r
                new Date(2001, 2 - 1, 3), 'Parse date \'day\' d of MM (\'\'DD\'\'), yy');\r
+       equalsDate($.datepicker.parseDate('y-m-d', '01-02-03'),\r
+               new Date(2001, 2 - 1, 3), 'Parse date y-m-d - default cutoff');\r
+       equalsDate($.datepicker.parseDate('y-m-d', '51-02-03'),\r
+               new Date(1951, 2 - 1, 3), 'Parse date y-m-d - default cutoff');\r
+       equalsDate($.datepicker.parseDate('y-m-d', '51-02-03', {shortYearCutoff: 80}),\r
+               new Date(2051, 2 - 1, 3), 'Parse date y-m-d - cutoff 80');\r
+       equalsDate($.datepicker.parseDate('y-m-d', '51-02-03', {shortYearCutoff: '+60'}),\r
+               new Date(2051, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');\r
        var daysShort = ['D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7'];\r
        var daysLong = ['Day1', 'Day2', 'Day3', 'Day4', 'Day5', 'Day6', 'Day7'];\r
        var monthsShort = ['M1', 'M2', 'M3', 'M4', 'M5', 'M6',\r