var inp = init('#inp');
var date = new Date();
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
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),
'Keystroke enter - preset');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
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');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ESC});
+ simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
ok(inp.datepicker('getDate') == null, 'Keystroke esc');
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),
'Keystroke esc - preset');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ESC});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
'Keystroke esc - abandoned');
// Moving by day or week
inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_LEFT}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.LEFT}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_RIGHT}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 7);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_UP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_DOWN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 7);
equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
// Moving by month or year
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
'Keystroke pgup');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
'Keystroke pgdn');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
'Keystroke ctrl+pgup');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
'Keystroke ctrl+pgdn');
// Check for moving to short months
inp.val('03/31/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
'Keystroke pgup - Feb');
inp.val('01/30/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
'Keystroke pgdn - Feb');
inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
'Keystroke ctrl+pgup - Feb');
inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
'Keystroke ctrl+pgdn - Feb');
// Goto current
inp.datepicker('option', {gotoCurrent: true}).
datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
'Keystroke ctrl+home');
// Change steps
inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
'Keystroke pgup step 2');
inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
'Keystroke pgdn step 2');
});
var date = new Date();
// onSelect
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(selectedThis, inp[0], 'Callback selected this');
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date');
inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date - ctrl+down');
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ESC});
+ simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date - esc');
var dateStr = '02/04/2008';
inp.val(dateStr).datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(dateStr, selectedDate,
'onSelect is called after enter keydown');
// onChangeMonthYear
};
date = new Date();
date.setDate(1);
- inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP});
+ inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
equal(selectedThis, inp[0], 'Callback change month/year this');
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'Callback change month/year date - ctrl+pgdn');
// onChangeMonthYear step by 2
inp.datepicker('option', {stepMonths: 2}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_PGUP});
+ simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 14);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'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);
equal(selectedDate, newMonthYear(date),
'Callback change month/year by 2 date - ctrl+pgdn');
// onClose
inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ESC});
+ simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], 'Callback close this');
equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
equal(selectedDate, '', 'Callback close date - esc');
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()),
'Callback close date - enter');
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');
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');
var inp2 = init('#inp2');
ok(image.length == 0, 'Focus - image absent');
inp.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');
inp.focus();
ok(dp.is(':visible'), 'Focus - rendered on focus');
var inp = init('#inp');
var date = new Date();
inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
// Numeric values
inp.datepicker('option', {defaultDate: -2}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date -2');
inp.datepicker('option', {defaultDate: 3}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 5);
equalsDate(inp.datepicker('getDate'), date, 'Default date 3');
inp.datepicker('option', {defaultDate: 1 / 0}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 3);
equalsDate(inp.datepicker('getDate'), date, 'Default date Infinity');
inp.datepicker('option', {defaultDate: 1 / 'a'}).
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');
// String offset values
inp.datepicker('option', {defaultDate: '-1d'}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
equalsDate(inp.datepicker('getDate'), date, 'Default date -1d');
inp.datepicker('option', {defaultDate: '+3D'}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 4);
equalsDate(inp.datepicker('getDate'), date, 'Default date +3D');
inp.datepicker('option', {defaultDate: ' -2 w '}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date = new Date();
date.setDate(date.getDate() - 14);
equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w');
inp.datepicker('option', {defaultDate: '+1 W'}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 21);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W');
inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
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});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date = addMonths(new Date(), 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date = new Date();
date.setFullYear(date.getFullYear() - 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date -2y');
inp.datepicker('option', {defaultDate: '+1 Y '}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date.setFullYear(date.getFullYear() + 3);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y');
inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
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});
+ simulate('keydown', {keyCode: $.ui.keyCode.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});
+ simulate('keydown', {keyCode: $.ui.keyCode.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', {dateFormat: 'mm/dd/yy', defaultDate: date}).
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');
});
longNames[date.getMonth()], 'Navigation current - as date format');
equal(dp.find('.ui-datepicker-next').text(),
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(),
'< ' + shortNames[1], 'Navigation prev - as date format + pgdn');
equal(dp.find('.ui-datepicker-current').text(),
var minDate = new Date(2008, 2 - 1, 29);
var maxDate = new Date(2008, 12 - 1, 7);
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), lastYear,
'Min/max - null, null - ctrl+pgup');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), nextYear,
'Min/max - null, null - ctrl+pgdn');
inp.datepicker('option', {minDate: minDate}).
datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), minDate,
'Min/max - 02/29/2008, null - ctrl+pgup');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), nextYear,
'Min/max - 02/29/2008, null - ctrl+pgdn');
inp.datepicker('option', {maxDate: maxDate}).
datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), minDate,
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), maxDate,
'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn');
inp.datepicker('option', {minDate: null}).
datepicker('hide').val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), lastYear,
'Min/max - null, 12/07/2008 - ctrl+pgup');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), maxDate,
'Min/max - null, 12/07/2008 - ctrl+pgdn');
// Relative dates
date.setDate(date.getDate() - 7);
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
datepicker('hide').val('').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
date = addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
inp.val('').datepicker('show');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgdn');
// With existing date
// No alternate field set
alt.val('');
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(alt.val(), '', 'Alt field - alt not set');
// Alternate field set
alt.val('');
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}).
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(alt.val(), '2008-06-04', 'Alt field - alt - enter');
// Move from initial date
alt.val('');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn');
equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn');
// Alternate field set - closed
alt.val('');
inp.val('06/04/2008').datepicker('show');
- inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
- simulate('keydown', {keyCode: $.simulate.VK_ESC});
+ inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc');
equal(alt.val(), '', 'Alt field - alt - pgdn/esc');
// Clear date and alternate
alt.val('');
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(alt.val(), '', 'Alt field - alt - ctrl+end');
'Localisation - day ' + day);
day = (day + 1) % 7;
});
- inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
var date = new Date();
equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' +
date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] +