mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker tests: Use $.ui.keyCode instead of $.simulate.VK_*.
This commit is contained in:
parent
0370170b2f
commit
a709943a8b
@ -235,132 +235,132 @@ test('keystrokes', function() {
|
|||||||
var inp = init('#inp');
|
var inp = init('#inp');
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke enter - preset');
|
'Keystroke enter - preset');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
|
ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
ok(inp.datepicker('getDate') == null, 'Keystroke esc');
|
ok(inp.datepicker('getDate') == null, 'Keystroke esc');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke esc - preset');
|
'Keystroke esc - preset');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke esc - abandoned');
|
'Keystroke esc - abandoned');
|
||||||
// Moving by day or week
|
// Moving by day or week
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 1);
|
date.setDate(date.getDate() - 1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_LEFT}).
|
simulate('keydown', {keyCode: $.ui.keyCode.LEFT}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 1);
|
date.setDate(date.getDate() + 1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 1);
|
date.setDate(date.getDate() + 1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_RIGHT}).
|
simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 1);
|
date.setDate(date.getDate() - 1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_UP}).
|
simulate('keydown', {keyCode: $.ui.keyCode.UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_DOWN}).
|
simulate('keydown', {keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
|
||||||
// Moving by month or year
|
// Moving by month or year
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
|
||||||
'Keystroke pgup');
|
'Keystroke pgup');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
|
||||||
'Keystroke pgdn');
|
'Keystroke pgdn');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
|
||||||
'Keystroke ctrl+pgup');
|
'Keystroke ctrl+pgup');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
|
||||||
'Keystroke ctrl+pgdn');
|
'Keystroke ctrl+pgdn');
|
||||||
// Check for moving to short months
|
// Check for moving to short months
|
||||||
inp.val('03/31/2008').datepicker('show').
|
inp.val('03/31/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
||||||
'Keystroke pgup - Feb');
|
'Keystroke pgup - Feb');
|
||||||
inp.val('01/30/2008').datepicker('show').
|
inp.val('01/30/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
|
||||||
'Keystroke pgdn - Feb');
|
'Keystroke pgdn - Feb');
|
||||||
inp.val('02/29/2008').datepicker('show').
|
inp.val('02/29/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
|
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
|
||||||
'Keystroke ctrl+pgup - Feb');
|
'Keystroke ctrl+pgup - Feb');
|
||||||
inp.val('02/29/2008').datepicker('show').
|
inp.val('02/29/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
|
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
|
||||||
'Keystroke ctrl+pgdn - Feb');
|
'Keystroke ctrl+pgdn - Feb');
|
||||||
// Goto current
|
// Goto current
|
||||||
inp.datepicker('option', {gotoCurrent: true}).
|
inp.datepicker('option', {gotoCurrent: true}).
|
||||||
datepicker('hide').val('02/04/2008').datepicker('show').
|
datepicker('hide').val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
|
||||||
'Keystroke ctrl+home');
|
'Keystroke ctrl+home');
|
||||||
// Change steps
|
// Change steps
|
||||||
inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
|
inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
|
||||||
datepicker('hide').val('02/04/2008').datepicker('show').
|
datepicker('hide').val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
|
||||||
'Keystroke pgup step 2');
|
'Keystroke pgup step 2');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
|
||||||
'Keystroke pgdn step 2');
|
'Keystroke pgdn step 2');
|
||||||
});
|
});
|
||||||
|
@ -26,24 +26,24 @@ test('events', function() {
|
|||||||
var date = new Date();
|
var date = new Date();
|
||||||
// onSelect
|
// onSelect
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(selectedThis, inp[0], 'Callback selected this');
|
equal(selectedThis, inp[0], 'Callback selected this');
|
||||||
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
|
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
||||||
'Callback selected date');
|
'Callback selected date');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 7);
|
date.setDate(date.getDate() + 7);
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
||||||
'Callback selected date - ctrl+down');
|
'Callback selected date - ctrl+down');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
||||||
'Callback selected date - esc');
|
'Callback selected date - esc');
|
||||||
var dateStr = '02/04/2008';
|
var dateStr = '02/04/2008';
|
||||||
inp.val(dateStr).datepicker('show').
|
inp.val(dateStr).datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(dateStr, selectedDate,
|
equal(dateStr, selectedDate,
|
||||||
'onSelect is called after enter keydown');
|
'onSelect is called after enter keydown');
|
||||||
// onChangeMonthYear
|
// onChangeMonthYear
|
||||||
@ -54,25 +54,25 @@ test('events', function() {
|
|||||||
};
|
};
|
||||||
date = new Date();
|
date = new Date();
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 1);
|
date.setMonth(date.getMonth() - 1);
|
||||||
equal(selectedThis, inp[0], 'Callback change month/year this');
|
equal(selectedThis, inp[0], 'Callback change month/year this');
|
||||||
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
|
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - pgup');
|
'Callback change month/year date - pgup');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 1);
|
date.setMonth(date.getMonth() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - pgdn');
|
'Callback change month/year date - pgdn');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setFullYear(date.getFullYear() - 1);
|
date.setFullYear(date.getFullYear() - 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+pgup');
|
'Callback change month/year date - ctrl+pgup');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
|
||||||
date.setFullYear(date.getFullYear() + 1);
|
date.setFullYear(date.getFullYear() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+home');
|
'Callback change month/year date - ctrl+home');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setFullYear(date.getFullYear() + 1);
|
date.setFullYear(date.getFullYear() + 1);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year date - ctrl+pgdn');
|
'Callback change month/year date - ctrl+pgdn');
|
||||||
@ -84,38 +84,38 @@ test('events', function() {
|
|||||||
// onChangeMonthYear step by 2
|
// onChangeMonthYear step by 2
|
||||||
inp.datepicker('option', {stepMonths: 2}).
|
inp.datepicker('option', {stepMonths: 2}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_PGUP});
|
simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 14);
|
date.setMonth(date.getMonth() - 14);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - pgup');
|
'Callback change month/year by 2 date - pgup');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
|
||||||
date.setMonth(date.getMonth() - 12);
|
date.setMonth(date.getMonth() - 12);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - ctrl+pgup');
|
'Callback change month/year by 2 date - ctrl+pgup');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 2);
|
date.setMonth(date.getMonth() + 2);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - pgdn');
|
'Callback change month/year by 2 date - pgdn');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
date.setMonth(date.getMonth() + 12);
|
date.setMonth(date.getMonth() + 12);
|
||||||
equal(selectedDate, newMonthYear(date),
|
equal(selectedDate, newMonthYear(date),
|
||||||
'Callback change month/year by 2 date - ctrl+pgdn');
|
'Callback change month/year by 2 date - ctrl+pgdn');
|
||||||
// onClose
|
// onClose
|
||||||
inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
|
inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
|
||||||
val('').datepicker('show').
|
val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedThis, inp[0], 'Callback close this');
|
equal(selectedThis, inp[0], 'Callback close this');
|
||||||
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
|
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
|
||||||
equal(selectedDate, '', 'Callback close date - esc');
|
equal(selectedDate, '', 'Callback close date - esc');
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()),
|
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()),
|
||||||
'Callback close date - enter');
|
'Callback close date - enter');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedDate, '02/04/2008', 'Callback close date - preset');
|
equal(selectedDate, '02/04/2008', 'Callback close date - preset');
|
||||||
inp.val('02/04/2008').datepicker('show').
|
inp.val('02/04/2008').datepicker('show').
|
||||||
simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
equal(selectedDate, '', 'Callback close date - ctrl+end');
|
equal(selectedDate, '', 'Callback close date - ctrl+end');
|
||||||
|
|
||||||
var inp2 = init('#inp2');
|
var inp2 = init('#inp2');
|
||||||
|
@ -77,7 +77,7 @@ test('invocation', function() {
|
|||||||
ok(image.length == 0, 'Focus - image absent');
|
ok(image.length == 0, 'Focus - image absent');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
ok(!dp.is(':visible'), 'Focus - hidden on exit');
|
ok(!dp.is(':visible'), 'Focus - hidden on exit');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
||||||
@ -161,93 +161,93 @@ test('defaultDate', function() {
|
|||||||
var inp = init('#inp');
|
var inp = init('#inp');
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
|
||||||
// Numeric values
|
// Numeric values
|
||||||
inp.datepicker('option', {defaultDate: -2}).
|
inp.datepicker('option', {defaultDate: -2}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 2);
|
date.setDate(date.getDate() - 2);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date -2');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date -2');
|
||||||
inp.datepicker('option', {defaultDate: 3}).
|
inp.datepicker('option', {defaultDate: 3}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 5);
|
date.setDate(date.getDate() + 5);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date 3');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date 3');
|
||||||
inp.datepicker('option', {defaultDate: 1 / 0}).
|
inp.datepicker('option', {defaultDate: 1 / 0}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 3);
|
date.setDate(date.getDate() - 3);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date Infinity');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date Infinity');
|
||||||
inp.datepicker('option', {defaultDate: 1 / 'a'}).
|
inp.datepicker('option', {defaultDate: 1 / 'a'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date NaN');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date NaN');
|
||||||
// String offset values
|
// String offset values
|
||||||
inp.datepicker('option', {defaultDate: '-1d'}).
|
inp.datepicker('option', {defaultDate: '-1d'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() - 1);
|
date.setDate(date.getDate() - 1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date -1d');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date -1d');
|
||||||
inp.datepicker('option', {defaultDate: '+3D'}).
|
inp.datepicker('option', {defaultDate: '+3D'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 4);
|
date.setDate(date.getDate() + 4);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date +3D');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date +3D');
|
||||||
inp.datepicker('option', {defaultDate: ' -2 w '}).
|
inp.datepicker('option', {defaultDate: ' -2 w '}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = new Date();
|
date = new Date();
|
||||||
date.setDate(date.getDate() - 14);
|
date.setDate(date.getDate() - 14);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w');
|
||||||
inp.datepicker('option', {defaultDate: '+1 W'}).
|
inp.datepicker('option', {defaultDate: '+1 W'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setDate(date.getDate() + 21);
|
date.setDate(date.getDate() + 21);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W');
|
||||||
inp.datepicker('option', {defaultDate: ' -1 m '}).
|
inp.datepicker('option', {defaultDate: ' -1 m '}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = addMonths(new Date(), -1);
|
date = addMonths(new Date(), -1);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
|
||||||
inp.datepicker('option', {defaultDate: '+2M'}).
|
inp.datepicker('option', {defaultDate: '+2M'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = addMonths(new Date(), 2);
|
date = addMonths(new Date(), 2);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
|
||||||
inp.datepicker('option', {defaultDate: '-2y'}).
|
inp.datepicker('option', {defaultDate: '-2y'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = new Date();
|
date = new Date();
|
||||||
date.setFullYear(date.getFullYear() - 2);
|
date.setFullYear(date.getFullYear() - 2);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date -2y');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date -2y');
|
||||||
inp.datepicker('option', {defaultDate: '+1 Y '}).
|
inp.datepicker('option', {defaultDate: '+1 Y '}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date.setFullYear(date.getFullYear() + 3);
|
date.setFullYear(date.getFullYear() + 3);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y');
|
||||||
inp.datepicker('option', {defaultDate: '+1M +10d'}).
|
inp.datepicker('option', {defaultDate: '+1M +10d'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = addMonths(new Date(), 1);
|
date = addMonths(new Date(), 1);
|
||||||
date.setDate(date.getDate() + 10);
|
date.setDate(date.getDate() + 10);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
|
||||||
// String date values
|
// String date values
|
||||||
inp.datepicker('option', {defaultDate: '07/04/2007'}).
|
inp.datepicker('option', {defaultDate: '07/04/2007'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = new Date(2007, 7 - 1, 4);
|
date = new Date(2007, 7 - 1, 4);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007');
|
||||||
inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}).
|
inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
date = new Date(2007, 4 - 1, 2);
|
date = new Date(2007, 4 - 1, 2);
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02');
|
||||||
// Date value
|
// Date value
|
||||||
date = new Date(2007, 1 - 1, 26);
|
date = new Date(2007, 1 - 1, 26);
|
||||||
inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}).
|
inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}).
|
||||||
datepicker('hide').val('').datepicker('show').
|
datepicker('hide').val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ test('miscellaneous', function() {
|
|||||||
longNames[date.getMonth()], 'Navigation current - as date format');
|
longNames[date.getMonth()], 'Navigation current - as date format');
|
||||||
equal(dp.find('.ui-datepicker-next').text(),
|
equal(dp.find('.ui-datepicker-next').text(),
|
||||||
shortNames[2] + ' >', 'Navigation next - as date format');
|
shortNames[2] + ' >', 'Navigation next - as date format');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
|
||||||
equal(dp.find('.ui-datepicker-prev').text(),
|
equal(dp.find('.ui-datepicker-prev').text(),
|
||||||
'< ' + shortNames[1], 'Navigation prev - as date format + pgdn');
|
'< ' + shortNames[1], 'Navigation prev - as date format + pgdn');
|
||||||
equal(dp.find('.ui-datepicker-current').text(),
|
equal(dp.find('.ui-datepicker-current').text(),
|
||||||
@ -317,46 +317,46 @@ test('minMax', function() {
|
|||||||
var minDate = new Date(2008, 2 - 1, 29);
|
var minDate = new Date(2008, 2 - 1, 29);
|
||||||
var maxDate = new Date(2008, 12 - 1, 7);
|
var maxDate = new Date(2008, 12 - 1, 7);
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), lastYear,
|
equalsDate(inp.datepicker('getDate'), lastYear,
|
||||||
'Min/max - null, null - ctrl+pgup');
|
'Min/max - null, null - ctrl+pgup');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), nextYear,
|
equalsDate(inp.datepicker('getDate'), nextYear,
|
||||||
'Min/max - null, null - ctrl+pgdn');
|
'Min/max - null, null - ctrl+pgdn');
|
||||||
inp.datepicker('option', {minDate: minDate}).
|
inp.datepicker('option', {minDate: minDate}).
|
||||||
datepicker('hide').val('06/04/2008').datepicker('show');
|
datepicker('hide').val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), minDate,
|
equalsDate(inp.datepicker('getDate'), minDate,
|
||||||
'Min/max - 02/29/2008, null - ctrl+pgup');
|
'Min/max - 02/29/2008, null - ctrl+pgup');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), nextYear,
|
equalsDate(inp.datepicker('getDate'), nextYear,
|
||||||
'Min/max - 02/29/2008, null - ctrl+pgdn');
|
'Min/max - 02/29/2008, null - ctrl+pgdn');
|
||||||
inp.datepicker('option', {maxDate: maxDate}).
|
inp.datepicker('option', {maxDate: maxDate}).
|
||||||
datepicker('hide').val('06/04/2008').datepicker('show');
|
datepicker('hide').val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), minDate,
|
equalsDate(inp.datepicker('getDate'), minDate,
|
||||||
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup');
|
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), maxDate,
|
equalsDate(inp.datepicker('getDate'), maxDate,
|
||||||
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn');
|
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn');
|
||||||
inp.datepicker('option', {minDate: null}).
|
inp.datepicker('option', {minDate: null}).
|
||||||
datepicker('hide').val('06/04/2008').datepicker('show');
|
datepicker('hide').val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), lastYear,
|
equalsDate(inp.datepicker('getDate'), lastYear,
|
||||||
'Min/max - null, 12/07/2008 - ctrl+pgup');
|
'Min/max - null, 12/07/2008 - ctrl+pgup');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), maxDate,
|
equalsDate(inp.datepicker('getDate'), maxDate,
|
||||||
'Min/max - null, 12/07/2008 - ctrl+pgdn');
|
'Min/max - null, 12/07/2008 - ctrl+pgdn');
|
||||||
// Relative dates
|
// Relative dates
|
||||||
@ -364,15 +364,15 @@ test('minMax', function() {
|
|||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
|
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
|
||||||
datepicker('hide').val('').datepicker('show');
|
datepicker('hide').val('').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date,
|
equalsDate(inp.datepicker('getDate'), date,
|
||||||
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
|
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
|
||||||
date = addMonths(new Date(), 1);
|
date = addMonths(new Date(), 1);
|
||||||
date.setDate(date.getDate() + 10);
|
date.setDate(date.getDate() + 10);
|
||||||
inp.val('').datepicker('show');
|
inp.val('').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date,
|
equalsDate(inp.datepicker('getDate'), date,
|
||||||
'Min/max - -1w, +1 M +10 D - ctrl+pgdn');
|
'Min/max - -1w, +1 M +10 D - ctrl+pgdn');
|
||||||
// With existing date
|
// With existing date
|
||||||
@ -477,34 +477,34 @@ test('altField', function() {
|
|||||||
// No alternate field set
|
// No alternate field set
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
|
equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
|
||||||
equal(alt.val(), '', 'Alt field - alt not set');
|
equal(alt.val(), '', 'Alt field - alt not set');
|
||||||
// Alternate field set
|
// Alternate field set
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}).
|
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}).
|
||||||
val('06/04/2008').datepicker('show');
|
val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
|
equal(inp.val(), '06/04/2008', 'Alt field - dp - enter');
|
||||||
equal(alt.val(), '2008-06-04', 'Alt field - alt - enter');
|
equal(alt.val(), '2008-06-04', 'Alt field - alt - enter');
|
||||||
// Move from initial date
|
// Move from initial date
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn');
|
equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn');
|
||||||
equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn');
|
equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn');
|
||||||
// Alternate field set - closed
|
// Alternate field set - closed
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
|
||||||
simulate('keydown', {keyCode: $.simulate.VK_ESC});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc');
|
equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc');
|
||||||
equal(alt.val(), '', 'Alt field - alt - pgdn/esc');
|
equal(alt.val(), '', 'Alt field - alt - pgdn/esc');
|
||||||
// Clear date and alternate
|
// Clear date and alternate
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
equal(inp.val(), '', 'Alt field - dp - ctrl+end');
|
equal(inp.val(), '', 'Alt field - dp - ctrl+end');
|
||||||
equal(alt.val(), '', 'Alt field - alt - ctrl+end');
|
equal(alt.val(), '', 'Alt field - alt - ctrl+end');
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ test('localisation', function() {
|
|||||||
'Localisation - day ' + day);
|
'Localisation - day ' + day);
|
||||||
day = (day + 1) % 7;
|
day = (day + 1) % 7;
|
||||||
});
|
});
|
||||||
inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' +
|
equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' +
|
||||||
date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] +
|
date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] +
|
||||||
|
Loading…
Reference in New Issue
Block a user