aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-04-19 11:17:35 -0400
committerScott González <scott.gonzalez@gmail.com>2012-04-19 11:17:35 -0400
commit266cc84013c7c4d57771b2e4d0cdac3763a6764b (patch)
tree5a538ced5db1ddab2e8d71d0f8ff48c934062a5c
parentaf1b4d859d9563e43896d76086e1e9ebbb3ab74b (diff)
downloadjquery-ui-266cc84013c7c4d57771b2e4d0cdac3763a6764b.tar.gz
jquery-ui-266cc84013c7c4d57771b2e4d0cdac3763a6764b.zip
Tests: Lint.
-rw-r--r--grunt.js4
-rw-r--r--tests/unit/datepicker/datepicker_core.js80
-rw-r--r--tests/unit/datepicker/datepicker_events.js17
-rw-r--r--tests/unit/datepicker/datepicker_methods.js34
-rw-r--r--tests/unit/datepicker/datepicker_options.js231
-rw-r--r--tests/unit/datepicker/datepicker_tickets.js14
6 files changed, 191 insertions, 189 deletions
diff --git a/grunt.js b/grunt.js
index 48be599b7..07bd7a6ed 100644
--- a/grunt.js
+++ b/grunt.js
@@ -350,6 +350,7 @@ grunt.initConfig({
accordion_equalHeights: true,
accordion_setupTeardown: true,
accordion_state: true,
+ addMonths: true,
asyncTest: true,
commonWidgetTests: true,
container: true,
@@ -362,9 +363,11 @@ grunt.initConfig({
dragged: true,
el: true,
equal: true,
+ equalsDate: true,
expect: true,
Globalize: true,
heightAfter: true,
+ init: true,
isNotOpen: true,
isOpen: true,
menu_click: true,
@@ -376,6 +379,7 @@ grunt.initConfig({
offsetAfter: true,
offsetBefore: true,
ok: true,
+ PROP_NAME: true,
QUnit: true,
restoreScroll: true,
shouldBeDroppable: true,
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index bbc447ffe..4bf04d83e 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -53,52 +53,52 @@ test("widget method", function() {
});
test('baseStructure', function() {
- var inp = init('#inp');
- inp.focus();
- var dp = $('#ui-datepicker-div');
- var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
+ var header, title, table, thead, week, panel, inl, child,
+ inp = init('#inp').focus(),
+ dp = $('#ui-datepicker-div'),
+ iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7);
ok(dp.is(':visible'), 'Structure - datepicker visible');
ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
equal(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count');
- var header = dp.children(':first');
+ header = dp.children(':first');
ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
equal(header.children().length, 3, 'Structure - header child count');
- ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() != '', 'Structure - prev link');
- ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() != '', 'Structure - next link');
+ ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() !== '', 'Structure - prev link');
+ ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() !== '', 'Structure - next link');
- var title = header.children(':last');
- ok(title.is('div.ui-datepicker-title') && title.html() != '','Structure - title division');
+ title = header.children(':last');
+ ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
equal(title.children().length, 2, 'Structure - title child count');
- ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() != '', 'Structure - month text')
- ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() != '', 'Structure - year text')
+ ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() !== '', 'Structure - month text');
+ ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() !== '', 'Structure - year text');
- var table = dp.children(':eq(1)');
+ table = dp.children(':eq(1)');
ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
ok(table.children(':first').is('thead'), 'Structure - month table thead');
- var thead = table.children(':first').children(':first');
+ thead = table.children(':first').children(':first');
ok(thead.is('tr'), 'Structure - month table title row');
equal(thead.find('th').length, 7, 'Structure - month table title cells');
ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body');
ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count');
- var week = table.children(':eq(1)').children(':first');
+ week = table.children(':eq(1)').children(':first');
ok(week.is('tr'), 'Structure - month table week row');
equal(week.children().length, 7, 'Structure - week child count');
ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell');
ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
- ok(dp.children('iframe').length == (iframe ? 1 : 0), 'Structure - iframe');
+ ok(dp.children('iframe').length === (iframe ? 1 : 0), 'Structure - iframe');
inp.datepicker('hide').datepicker('destroy');
// Editable month/year and button panel
inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
inp.focus();
- var title = dp.find('div.ui-datepicker-title');
+ title = dp.find('div.ui-datepicker-title');
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
- var panel = dp.children(':last');
+ panel = dp.children(':last');
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
equal(panel.children().length, 2, 'Structure - button panel child count');
ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button');
@@ -110,7 +110,7 @@ test('baseStructure', function() {
inp.focus();
ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count');
- var child = dp.children(':first');
+ child = dp.children(':first');
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division');
child = dp.children(':eq(1)');
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
@@ -146,16 +146,16 @@ test('baseStructure', function() {
inp.datepicker('hide').datepicker('destroy');
// Inline
- var inl = init('#inl');
+ inl = init('#inl');
dp = inl.children();
ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div');
ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left');
ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month');
equal(dp.children().length, 2, 'Structure inline - child count');
- var header = dp.children(':first');
+ header = dp.children(':first');
ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
equal(header.children().length, 3, 'Structure inline - header child count');
- var table = dp.children(':eq(1)');
+ table = dp.children(':eq(1)');
ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table');
ok(table.children(':first').is('thead'), 'Structure inline - month table thead');
ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body');
@@ -176,19 +176,20 @@ test('baseStructure', function() {
});
test('customStructure', function() {
- var dp = $('#ui-datepicker-div');
- // Check right-to-left localisation
- var inp = init('#inp', $.datepicker.regional['he']);
+ var iframe, header, panel, title, thead,
+ dp = $('#ui-datepicker-div'),
+ // Check right-to-left localisation
+ inp = init('#inp', $.datepicker.regional.he);
inp.data('showButtonPanel.datepicker',true);
inp.focus();
- var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
+ iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7);
ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
- var header = dp.children(':first');
+ header = dp.children(':first');
ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
equal(header.children().length, 3, 'Structure RTL - header child count');
ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link');
ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');
- var panel = dp.children(':last');
+ panel = dp.children(':last');
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
equal(panel.children().length, 2, 'Structure RTL - button panel child count');
ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button');
@@ -198,7 +199,7 @@ test('customStructure', function() {
// Hide prev/next
inp = init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
inp.val('02/10/2008').focus();
- var header = dp.children(':first');
+ header = dp.children(':first');
ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division');
equal(header.children().length, 1, 'Structure hide prev/next - links child count');
ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
@@ -207,7 +208,7 @@ test('customStructure', function() {
// Changeable Month with read-only year
inp = init('#inp', {changeMonth: true});
inp.focus();
- var title = dp.children(':first').children(':last');
+ title = dp.children(':first').children(':last');
equal(title.children().length, 2, 'Structure changeable month - title child count');
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector');
ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
@@ -216,7 +217,7 @@ test('customStructure', function() {
// Changeable year with read-only month
inp = init('#inp', {changeYear: true});
inp.focus();
- var title = dp.children(':first').children(':last');
+ title = dp.children(':first').children(':last');
equal(title.children().length, 2, 'Structure changeable year - title child count');
ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month');
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
@@ -225,15 +226,15 @@ test('customStructure', function() {
// Read-only first day of week
inp = init('#inp', {changeFirstDay: false});
inp.focus();
- var thead = dp.find('.ui-datepicker-calendar thead tr');
+ thead = dp.find('.ui-datepicker-calendar thead tr');
equal(thead.children().length, 7, 'Structure read-only first day - thead child count');
equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count');
inp.datepicker('hide').datepicker('destroy');
});
test('keystrokes', function() {
- var inp = init('#inp');
- var date = new Date();
+ var inp = init('#inp'),
+ date = new Date();
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
@@ -366,9 +367,10 @@ test('keystrokes', function() {
});
test('mouse', function() {
- var inp = init('#inp');
- var dp = $('#ui-datepicker-div');
- var date = new Date();
+ var inl,
+ inp = init('#inp'),
+ dp = $('#ui-datepicker-div'),
+ date = new Date();
inp.val('').datepicker('show');
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
date.setDate(10);
@@ -419,9 +421,9 @@ test('mouse', function() {
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
'Mouse click - next + min/max');
// Inline
- var inl = init('#inl');
- var dp = $('.ui-datepicker-inline', inl);
- var date = new Date();
+ inl = init('#inl');
+ dp = $('.ui-datepicker-inline', inl);
+ date = new Date();
inl.datepicker('setDate', date);
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
date.setDate(10);
diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js
index 9876b7e60..b3e6704ef 100644
--- a/tests/unit/datepicker/datepicker_events.js
+++ b/tests/unit/datepicker/datepicker_events.js
@@ -5,9 +5,9 @@
module("datepicker: events");
-var selectedThis = null;
-var selectedDate = null;
-var selectedInst = null;
+var selectedThis = null,
+selectedDate = null,
+selectedInst = null;
function callback(date, inst) {
selectedThis = this;
@@ -22,8 +22,9 @@ function callback2(year, month, inst) {
}
test('events', function() {
- var inp = init('#inp', {onSelect: callback});
- var date = new Date();
+ var dateStr, newMonthYear, inp2,
+ inp = init('#inp', {onSelect: callback}),
+ date = new Date();
// onSelect
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
@@ -41,7 +42,7 @@ test('events', function() {
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date - esc');
- var dateStr = '02/04/2008';
+ dateStr = '02/04/2008';
inp.val(dateStr).datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(dateStr, selectedDate,
@@ -49,7 +50,7 @@ test('events', function() {
// onChangeMonthYear
inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
val('').datepicker('show');
- var newMonthYear = function(date) {
+ newMonthYear = function(date) {
return date.getFullYear() + '/' + (date.getMonth() + 1);
};
date = new Date();
@@ -118,7 +119,7 @@ test('events', function() {
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
equal(selectedDate, '', 'Callback close date - ctrl+end');
- var inp2 = init('#inp2');
+ inp2 = init('#inp2');
inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
inp.datepicker('show');
equal(selectedThis, inp2[0], 'Callback close this');
diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js
index c8f1b75b2..603427440 100644
--- a/tests/unit/datepicker/datepicker_methods.js
+++ b/tests/unit/datepicker/datepicker_methods.js
@@ -6,7 +6,8 @@
module("datepicker: methods");
test('destroy', function() {
- var inp = init('#inp');
+ var inl,
+ inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
ok($.data(inp[0], PROP_NAME), 'Default - instance present');
ok(inp.next().is('#alt'), 'Default - button absent');
@@ -19,7 +20,7 @@ test('destroy', function() {
inp= init('#inp', {showOn: 'both'});
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
ok($.data(inp[0], PROP_NAME), 'Button - instance present');
- ok(inp.next().text() == '...', 'Button - button added');
+ ok(inp.next().text() === '...', 'Button - button added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
@@ -29,7 +30,7 @@ test('destroy', function() {
inp = init('#inp', {appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
ok($.data(inp[0], PROP_NAME), 'Append - instance present');
- ok(inp.next().text() == 'Testing', 'Append - append text added');
+ ok(inp.next().text() === 'Testing', 'Append - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
@@ -40,29 +41,30 @@ test('destroy', function() {
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
ok($.data(inp[0], PROP_NAME), 'Both - instance present');
- ok(inp.next()[0].nodeName.toLowerCase() == 'img', 'Both - button added');
- ok(inp.next().next().text() == 'Testing', 'Both - append text added');
+ ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
+ ok(inp.next().next().text() === 'Testing', 'Both - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
ok(inp.next().is('#alt'), 'Both - button and append text absent');
// Inline
- var inl = init('#inl');
+ inl = init('#inl');
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
- ok(inl.html() != '', 'Inline - datepicker present');
+ ok(inl.html() !== '', 'Inline - datepicker present');
ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
- ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent');
+ ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
inl.datepicker('destroy');
inl = $('#inl');
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
- ok(inl.html() == '', 'Inline - datepicker absent');
+ ok(inl.html() === '', 'Inline - datepicker absent');
ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
- ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent');
+ ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
});
test('enableDisable', function() {
- var inp = init('#inp');
+ var inl, dp,
+ inp = init('#inp');
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
inp.datepicker('disable');
@@ -91,19 +93,19 @@ test('enableDisable', function() {
buttonImage: 'img/calendar.gif'});
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - initially marked as enabled');
ok(!inp[0].disabled, 'Enable/disable image - field initially enabled');
- ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image initially enabled');
+ ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image initially enabled');
inp.datepicker('disable');
ok(inp.datepicker('isDisabled'), 'Enable/disable image - now marked as disabled');
ok(inp[0].disabled, 'Enable/disable image - field now disabled');
- ok(inp.next('img').css('opacity') != 1, 'Enable/disable image - image now disabled');
+ ok(parseFloat(inp.next('img').css('opacity')) !== 1, 'Enable/disable image - image now disabled');
inp.datepicker('enable');
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - now marked as enabled');
ok(!inp[0].disabled, 'Enable/disable image - field now enabled');
- ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image now enabled');
+ ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image now enabled');
inp.datepicker('destroy');
// Inline
- var inl = init('#inl', {changeYear: true});
- var dp = $('.ui-datepicker-inline', inl);
+ inl = init('#inl', {changeYear: true});
+ dp = $('.ui-datepicker-inline', inl);
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially');
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index f538c6d03..3e200ecaa 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -16,8 +16,8 @@ test('setDefaults', function() {
});
test('option', function() {
- var inp = init('#inp');
- var inst = $.data(inp[0], PROP_NAME);
+ var inp = init('#inp'),
+ inst = $.data(inp[0], PROP_NAME);
// Set option
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
@@ -47,8 +47,8 @@ test('option', function() {
});
test('change', function() {
- var inp = init('#inp');
- var inst = $.data(inp[0], PROP_NAME);
+ var inp = init('#inp'),
+ inst = $.data(inp[0], PROP_NAME);
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
@@ -67,14 +67,15 @@ test('change', function() {
});
test('invocation', function() {
- var inp = init('#inp');
- var dp = $('#ui-datepicker-div');
- var body = $('body');
+ var button, image,
+ inp = init('#inp'),
+ dp = $('#ui-datepicker-div'),
+ body = $('body');
// On focus
- var button = inp.siblings('button');
- ok(button.length == 0, 'Focus - button absent');
- var image = inp.siblings('img');
- ok(image.length == 0, 'Focus - image absent');
+ button = inp.siblings('button');
+ ok(button.length === 0, 'Focus - button absent');
+ image = inp.siblings('img');
+ ok(image.length === 0, 'Focus - image absent');
inp.focus();
ok(dp.is(':visible'), 'Focus - rendered on focus');
inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
@@ -89,8 +90,8 @@ test('invocation', function() {
ok(!dp.is(':visible'), 'Button - initially hidden');
button = inp.siblings('button');
image = inp.siblings('img');
- ok(button.length == 1, 'Button - button present');
- ok(image.length == 0, 'Button - image absent');
+ ok(button.length === 1, 'Button - button present');
+ ok(image.length === 0, 'Button - image absent');
equal(button.text(), 'Popup', 'Button - button text');
inp.focus();
ok(!dp.is(':visible'), 'Button - not rendered on focus');
@@ -104,9 +105,9 @@ test('invocation', function() {
buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
ok(!dp.is(':visible'), 'Image button - initially hidden');
button = inp.siblings('button');
- ok(button.length == 0, 'Image button - button absent');
+ ok(button.length === 0, 'Image button - button absent');
image = inp.siblings('img');
- ok(image.length == 1, 'Image button - image present');
+ ok(image.length === 1, 'Image button - image present');
equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source');
equal(image.attr('title'), 'Cal', 'Image button - image text');
inp.focus();
@@ -120,11 +121,11 @@ test('invocation', function() {
inp = init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
ok(!dp.is(':visible'), 'Both - initially hidden');
button = inp.siblings('button');
- ok(button.length == 1, 'Both - button present');
+ ok(button.length === 1, 'Both - button present');
image = inp.siblings('img');
- ok(image.length == 0, 'Both - image absent');
+ ok(image.length === 0, 'Both - image absent');
image = button.children('img');
- ok(image.length == 1, 'Both - button image present');
+ ok(image.length === 1, 'Both - button image present');
inp.focus();
ok(dp.is(':visible'), 'Both - rendered on focus');
body.simulate('mousedown', {});
@@ -137,29 +138,29 @@ test('invocation', function() {
});
test('otherMonths', function() {
- var inp = init('#inp');
- var pop = $('#ui-datepicker-div');
+ var inp = init('#inp'),
+ pop = $('#ui-datepicker-div');
inp.val('06/01/2009').datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
'Other months - none');
- ok(pop.find('td:last *').length == 0, 'Other months - no content');
+ ok(pop.find('td:last *').length === 0, 'Other months - no content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
'Other months - show');
- ok(pop.find('td:last span').length == 1, 'Other months - span content');
+ ok(pop.find('td:last span').length === 1, 'Other months - span content');
inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show');
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
'Other months - select');
- ok(pop.find('td:last a').length == 1, 'Other months - link content');
+ ok(pop.find('td:last a').length === 1, 'Other months - link content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
'Other months - none');
- ok(pop.find('td:last *').length == 0, 'Other months - no content');
+ ok(pop.find('td:last *').length === 0, 'Other months - no content');
});
test('defaultDate', function() {
- var inp = init('#inp');
- var date = new Date();
+ var inp = init('#inp'),
+ date = new Date();
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
@@ -252,17 +253,19 @@ test('defaultDate', function() {
});
test('miscellaneous', function() {
- var dp = $('#ui-datepicker-div');
- var inp = init('#inp');
+ var curYear, longNames, shortNames, date,
+ dp = $('#ui-datepicker-div'),
+ inp = init('#inp');
// Year range
- var genRange = function(start, offset) {
- var range = '';
- for (var i = start; i < start + offset; i++) {
+ function genRange(start, offset) {
+ var i = start,
+ range = '';
+ for (; i < start + offset; i++) {
range += i;
}
return range;
- };
- var curYear = new Date().getFullYear();
+ }
+ curYear = new Date().getFullYear();
inp.val('02/04/2008').datepicker('show');
equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default');
inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show');
@@ -285,9 +288,9 @@ test('miscellaneous', function() {
equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default');
inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).
val('02/04/2008').datepicker('show');
- var longNames = $.datepicker.regional[''].monthNames;
- var shortNames = $.datepicker.regional[''].monthNamesShort;
- var date = new Date();
+ longNames = $.datepicker.regional[''].monthNames;
+ shortNames = $.datepicker.regional[''].monthNamesShort;
+ date = new Date();
equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format');
equal(dp.find('.ui-datepicker-current').text(),
longNames[date.getMonth()], 'Navigation current - as date format');
@@ -311,11 +314,12 @@ test('miscellaneous', function() {
});
test('minMax', function() {
- var inp = init('#inp');
- var lastYear = new Date(2007, 6 - 1, 4);
- var nextYear = new Date(2009, 6 - 1, 4);
- var minDate = new Date(2008, 2 - 1, 29);
- var maxDate = new Date(2008, 12 - 1, 7);
+ var date,
+ inp = init('#inp'),
+ lastYear = new Date(2007, 6 - 1, 4),
+ nextYear = new Date(2009, 6 - 1, 4),
+ minDate = new Date(2008, 2 - 1, 29),
+ maxDate = new Date(2008, 12 - 1, 7);
inp.val('06/04/2008').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
@@ -360,7 +364,7 @@ test('minMax', function() {
equalsDate(inp.datepicker('getDate'), maxDate,
'Min/max - null, 12/07/2008 - ctrl+pgdn');
// Relative dates
- var date = new Date();
+ date = new Date();
date.setDate(date.getDate() - 7);
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
datepicker('hide').val('').datepicker('show');
@@ -394,9 +398,10 @@ test('minMax', function() {
});
test('setDate', function() {
- var inp = init('#inp');
- var date1 = new Date(2008, 6 - 1, 4);
- var date2 = new Date();
+ var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
+ inp = init('#inp'),
+ date1 = new Date(2008, 6 - 1, 4),
+ date2 = new Date();
ok(inp.datepicker('getDate') == null, 'Set date - default');
inp.datepicker('setDate', date1);
equalsDate(inp.datepicker('getDate'), date1, 'Set date - 2008-06-04');
@@ -423,7 +428,7 @@ test('setDate', function() {
inp.datepicker('setDate', 'c -3 w');
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c -3 w');
// Inline
- var inl = init('#inl');
+ inl = init('#inl');
date1 = new Date(2008, 6 - 1, 4);
date2 = new Date();
equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - default');
@@ -441,7 +446,7 @@ test('setDate', function() {
inl.datepicker('setDate');
ok(inl.datepicker('getDate') == null, 'Set date inline - null');
// Alternate field
- var alt = $('#alt');
+ alt = $('#alt');
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'});
date1 = new Date(2008, 6 - 1, 4);
inp.datepicker('setDate', date1);
@@ -451,8 +456,8 @@ test('setDate', function() {
inp = init('#inp');
date1 = new Date(2008, 1 - 1, 4);
date2 = new Date(2008, 6 - 1, 4);
- var minDate = new Date(2008, 2 - 1, 29);
- var maxDate = new Date(2008, 3 - 1, 28);
+ minDate = new Date(2008, 2 - 1, 29);
+ maxDate = new Date(2008, 3 - 1, 28);
inp.val('').datepicker('option', {minDate: minDate}).datepicker('setDate', date2);
equalsDate(inp.datepicker('getDate'), date2, 'Set date min/max - setDate > min');
inp.datepicker('setDate', date1);
@@ -465,15 +470,15 @@ test('setDate', function() {
equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min');
inp.datepicker('setDate', date2);
equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max');
- var dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0);
- var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
+ dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0);
+ dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
inp.datepicker('setDate', dateAndTimeToSet);
equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate');
});
test('altField', function() {
- var inp = init('#inp');
- var alt = $('#alt');
+ var inp = init('#inp'),
+ alt = $('#alt');
// No alternate field set
alt.val('');
inp.val('06/04/2008').datepicker('show');
@@ -507,26 +512,6 @@ test('altField', function() {
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');
-
- return
- // TODO manual entry impl works (see altField demo) but this test doesn't
- // probably something the rewrite won't cover anymore anyway
-
- // Verify alt field is updated on keyup
- alt.val('');
- inp.val('06/04/200').datepicker('show');
- inp.simulate('keydown', {charCode: '8'.charCodeAt(0)});
- inp.simulate('keypress', {charCode: '8'.charCodeAt(0)});
- inp.simulate('keyup', {charCode: '8'.charCodeAt(0)});
- equal(inp.val(), '06/04/2008', 'Alt field - dp - manual entry');
- equal(alt.val(), '2008-06-04', 'Alt field - manual entry');
- // Verify alt field is not updated on keyup if date is invalid
- inp.val('12/04');
- inp.simulate('keydown', {charCode: '/'.charCodeAt(0)});
- inp.simulate('keypress', {charCode: '/'.charCodeAt(0)});
- inp.simulate('keyup', {charCode: '/'.charCodeAt(0)});
- equal(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete');
- equal(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated');
});
test('autoSize', function() {
@@ -541,7 +526,7 @@ test('autoSize', function() {
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy');
// French
- inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr']));
+ inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.fr));
equal(inp.prop('size'), 29, 'Auto size - fr - default');
inp.datepicker('option', 'autoSize', true);
equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy');
@@ -552,7 +537,7 @@ test('autoSize', function() {
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy');
// Hebrew
- inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he']));
+ inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.he));
equal(inp.prop('size'), 28, 'Auto size - he - default');
inp.datepicker('option', 'autoSize', true);
equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy');
@@ -565,8 +550,8 @@ test('autoSize', function() {
});
test('daylightSaving', function() {
- var inp = init('#inp');
- var dp = $('#ui-datepicker-div');
+ var inp = init('#inp'),
+ dp = $('#ui-datepicker-div');
ok(true, 'Daylight saving - ' + new Date());
// Australia, Sydney - AM change, southern hemisphere
inp.val('04/01/2008').datepicker('show');
@@ -646,9 +631,12 @@ test('daylightSaving', function() {
equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008');
});
-var beforeShowThis = null;
-var beforeShowInput = null;
-var beforeShowInst = null;
+var beforeShowThis = null,
+ beforeShowInput = null,
+ beforeShowInst = null,
+ beforeShowDayThis = null,
+ beforeShowDayOK = true;
+
function beforeAll(input, inst) {
beforeShowThis = this;
@@ -657,84 +645,86 @@ function beforeAll(input, inst) {
return {currentText: 'Current'};
}
-var beforeShowDayThis = null;
-var beforeShowDayOK = true;
-
function beforeDay(date) {
beforeShowDayThis = this;
beforeShowDayOK &= (date > new Date(2008, 1 - 1, 26) &&
date < new Date(2008, 3 - 1, 6));
- return [(date.getDate() % 2 == 0), (date.getDate() % 10 == 0 ? 'day10' : ''),
- (date.getDate() % 3 == 0 ? 'Divisble by 3' : '')];
+ return [(date.getDate() % 2 === 0), (date.getDate() % 10 === 0 ? 'day10' : ''),
+ (date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
}
function calcWeek(date) {
- var doy = date.getDate() + 6;
- for (var m = date.getMonth() - 1; m >= 0; m--)
+ var doy = date.getDate() + 6,
+ m = date.getMonth() - 1;
+ for (; m >= 0; m--) {
doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
+ }
// Simple count from 01/01 starting at week 1
return Math.floor(doy / 7);
}
test('callbacks', function() {
// Before show
- var inp = init('#inp', {beforeShow: beforeAll});
- var inst = $.data(inp[0], 'datepicker');
+ var dp, day20, day21,
+ inp = init('#inp', {beforeShow: beforeAll}),
+ inst = $.data(inp[0], 'datepicker');
equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial');
inp.val('02/04/2008').datepicker('show');
equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed');
- ok(beforeShowThis.id == inp[0].id, 'Before show - this OK');
- ok(beforeShowInput.id == inp[0].id, 'Before show - input OK');
+ ok(beforeShowThis.id === inp[0].id, 'Before show - this OK');
+ ok(beforeShowInput.id === inp[0].id, 'Before show - input OK');
deepEqual(beforeShowInst, inst, 'Before show - inst OK');
inp.datepicker('hide').datepicker('destroy');
// Before show day
inp = init('#inp', {beforeShowDay: beforeDay});
- var dp = $('#ui-datepicker-div');
+ dp = $('#ui-datepicker-div');
inp.val('02/04/2008').datepicker('show');
- ok(beforeShowDayThis.id == inp[0].id, 'Before show day - this OK');
+ ok(beforeShowDayThis.id === inp[0].id, 'Before show day - this OK');
ok(beforeShowDayOK, 'Before show day - dates OK');
- var day20 = dp.find('.ui-datepicker-calendar td:contains("20")');
- var day21 = dp.find('.ui-datepicker-calendar td:contains("21")');
+ day20 = dp.find('.ui-datepicker-calendar td:contains("20")');
+ day21 = dp.find('.ui-datepicker-calendar td:contains("21")');
ok(!day20.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 20');
ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21');
ok(day20.is('.day10'), 'Before show day - CSS 20');
ok(!day21.is('.day10'), 'Before show day - CSS 21');
ok(!day20.attr('title'), 'Before show day - title 20');
- ok(day21.attr('title') == 'Divisble by 3', 'Before show day - title 21');
+ ok(day21.attr('title') === 'Divisble by 3', 'Before show day - title 21');
inp.datepicker('hide').datepicker('destroy');
});
test('localisation', function() {
- var inp = init('#inp', $.datepicker.regional['fr']);
+ var dp, month, day, date,
+ inp = init('#inp', $.datepicker.regional.fr);
inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show');
- var dp = $('#ui-datepicker-div');
+ dp = $('#ui-datepicker-div');
equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close');
$('.ui-datepicker-close', dp).simulate('mouseover');
equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous');
equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current');
equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next');
- var month = 0;
+ month = 0;
$('.ui-datepicker-month option', dp).each(function() {
- equal($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month],
+ equal($(this).text(), $.datepicker.regional.fr.monthNamesShort[month],
'Localisation - month ' + month);
month++;
});
- var day = 1;
+ day = 1;
$('.ui-datepicker-calendar th', dp).each(function() {
- equal($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day],
+ equal($(this).text(), $.datepicker.regional.fr.dayNamesMin[day],
'Localisation - day ' + day);
day = (day + 1) % 7;
});
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()] +
+ date = new Date();
+ equal(inp.val(), $.datepicker.regional.fr.dayNames[date.getDay()] + ', ' +
+ date.getDate() + ' ' + $.datepicker.regional.fr.monthNames[date.getMonth()] +
' ' + date.getFullYear(), 'Localisation - formatting');
});
test('noWeekends', function() {
- for (var i = 1; i <= 31; i++) {
- var date = new Date(2001, 1 - 1, i);
+ var i, date;
+ for (i = 1; i <= 31; i++) {
+ date = new Date(2001, 1 - 1, i);
deepEqual($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],
'No weekends ' + date);
}
@@ -769,6 +759,7 @@ test('iso8601Week', function() {
test('parseDate', function() {
init('#inp');
+ var currentYear, gmtDate, fr, settings, zh;
ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
equalsDate($.datepicker.parseDate('d m y', '3 2 01'),
new Date(2001, 2 - 1, 3), 'Parse date d m y');
@@ -793,7 +784,7 @@ test('parseDate', function() {
equalsDate($.datepicker.parseDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
'day 3 of February (\'Saturday\'), 2001'), new Date(2001, 2 - 1, 3),
'Parse date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
- var currentYear = new Date().getFullYear();
+ currentYear = new Date().getFullYear();
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000) + '-02-03'),
new Date(currentYear, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 10) + '-02-03'),
@@ -808,12 +799,12 @@ test('parseDate', function() {
new Date(currentYear + 60, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 61) + '-02-03', {shortYearCutoff: '+60'}),
new Date(currentYear - 39, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
- var gmtDate = new Date(2001, 2 - 1, 3);
+ gmtDate = new Date(2001, 2 - 1, 3);
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
equalsDate($.datepicker.parseDate('@', '981158400000'), gmtDate, 'Parse date @');
equalsDate($.datepicker.parseDate('!', '631167552000000000'), gmtDate, 'Parse date !');
- var fr = $.datepicker.regional['fr'];
- var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
+ fr = $.datepicker.regional.fr;
+ settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
equalsDate($.datepicker.parseDate('D d M y', 'Lun. 9 Avril 01', settings),
new Date(2001, 4 - 1, 9), 'Parse date D M y with settings');
@@ -825,14 +816,15 @@ test('parseDate', function() {
'jour 9 de Avril (\'Lundi\'), 2001', settings), new Date(2001, 4 - 1, 9),
'Parse date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
- var zh = $.datepicker.regional['zh-CN'];
+ zh = $.datepicker.regional['zh-CN'];
equalsDate($.datepicker.parseDate('yy M d', '2011 十一 22', zh),
new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
});
test('parseDateErrors', function() {
init('#inp');
- var expectError = function(expr, value, error) {
+ var fr, settings;
+ function expectError(expr, value, error) {
try {
expr();
ok(false, 'Parsed error ' + value);
@@ -840,7 +832,7 @@ test('parseDateErrors', function() {
catch (e) {
equal(e, error, 'Parsed error ' + value);
}
- };
+ }
expectError(function() { $.datepicker.parseDate(null, 'Sat 2 01'); },
'Sat 2 01', 'Invalid arguments');
expectError(function() { $.datepicker.parseDate('d m y', null); },
@@ -872,8 +864,8 @@ test('parseDateErrors', function() {
'day 3 of Mon2 ("Day7"), 2001', 'Unexpected literal at position 19');
expectError(function() { $.datepicker.parseDate('d m y', '29 2 01'); },
'29 2 01 - d m y', 'Invalid date');
- var fr = $.datepicker.regional['fr'];
- var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
+ fr = $.datepicker.regional.fr;
+ settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
expectError(function() { $.datepicker.parseDate('D d M y', 'Mon 9 Avr 01', settings); },
'Mon 9 Avr 01 - D d M y', 'Unknown name at position 0');
@@ -883,6 +875,7 @@ test('parseDateErrors', function() {
test('formatDate', function() {
init('#inp');
+ var gmtDate, fr, settings;
equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),
'3 2 01', 'Format date d m y');
equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)),
@@ -904,12 +897,12 @@ test('formatDate', function() {
equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001',
'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
- var gmtDate = new Date(2001, 2 - 1, 3);
+ gmtDate = new Date(2001, 2 - 1, 3);
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @');
equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !');
- var fr = $.datepicker.regional['fr'];
- var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
+ fr = $.datepicker.regional.fr;
+ settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings),
'Lun. Avril 01', 'Format date D M y with settings');
diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js
index fcf712370..105be63a6 100644
--- a/tests/unit/datepicker/datepicker_tickets.js
+++ b/tests/unit/datepicker/datepicker_tickets.js
@@ -7,8 +7,8 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
- var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }});
- var dp = $('#ui-datepicker-div');
+ var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
+ dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
// contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
@@ -26,11 +26,11 @@ test('beforeShowDay-getDate', function() {
test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler', function(){
var inp = init('#inp',{
- beforeShow: function(){
- return false;
- }
- });
- var dp = $('#ui-datepicker-div');
+ beforeShow: function(){
+ return false;
+ }
+ }),
+ dp = $('#ui-datepicker-div');
inp.datepicker('show');
equal(dp.css('display'), 'none',"beforeShow returns false");
inp.datepicker('destroy');