aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/datepicker
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-06-27 11:32:48 -0400
committerScott González <scott.gonzalez@gmail.com>2012-06-27 11:32:48 -0400
commit5ae668fdb61dd5e516dc599166a31fd46a916bfd (patch)
tree002c635b5410177d4de10c2288230fdd0bbcdbab /tests/unit/datepicker
parent9b6c1c5cdb18d76d9febfc079a1cc439dc3789b3 (diff)
downloadjquery-ui-5ae668fdb61dd5e516dc599166a31fd46a916bfd.tar.gz
jquery-ui-5ae668fdb61dd5e516dc599166a31fd46a916bfd.zip
Tests: Enable QUnit.config.requireExpects.
Diffstat (limited to 'tests/unit/datepicker')
-rw-r--r--tests/unit/datepicker/datepicker_core.js6
-rw-r--r--tests/unit/datepicker/datepicker_events.js1
-rw-r--r--tests/unit/datepicker/datepicker_methods.js2
-rw-r--r--tests/unit/datepicker/datepicker_options.js19
-rw-r--r--tests/unit/datepicker/datepicker_tickets.js4
5 files changed, 32 insertions, 0 deletions
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 4bf04d83e..17cefe157 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -43,16 +43,19 @@ var PROP_NAME = 'datepicker';
module("datepicker: core");
test( "widget method - empty collection", function() {
+ expect( 1 );
$( "#nonExist" ).datepicker(); // should create nothing
ok( !$( "#ui-datepicker-div" ).length, "Non init on empty collection" );
});
test("widget method", function() {
+ expect( 1 );
var actual = $("#inp").datepicker().datepicker("widget")[0];
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
});
test('baseStructure', function() {
+ expect( 59 );
var header, title, table, thead, week, panel, inl, child,
inp = init('#inp').focus(),
dp = $('#ui-datepicker-div'),
@@ -176,6 +179,7 @@ test('baseStructure', function() {
});
test('customStructure', function() {
+ expect( 20 );
var iframe, header, panel, title, thead,
dp = $('#ui-datepicker-div'),
// Check right-to-left localisation
@@ -233,6 +237,7 @@ test('customStructure', function() {
});
test('keystrokes', function() {
+ expect( 26 );
var inp = init('#inp'),
date = new Date();
inp.val('').datepicker('show').
@@ -367,6 +372,7 @@ test('keystrokes', function() {
});
test('mouse', function() {
+ expect( 15 );
var inl,
inp = init('#inp'),
dp = $('#ui-datepicker-div'),
diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js
index b3e6704ef..e35be62ce 100644
--- a/tests/unit/datepicker/datepicker_events.js
+++ b/tests/unit/datepicker/datepicker_events.js
@@ -22,6 +22,7 @@ function callback2(year, month, inst) {
}
test('events', function() {
+ expect( 26 );
var dateStr, newMonthYear, inp2,
inp = init('#inp', {onSelect: callback}),
date = new Date();
diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js
index 603427440..e7aa7602e 100644
--- a/tests/unit/datepicker/datepicker_methods.js
+++ b/tests/unit/datepicker/datepicker_methods.js
@@ -6,6 +6,7 @@
module("datepicker: methods");
test('destroy', function() {
+ expect( 33 );
var inl,
inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
@@ -63,6 +64,7 @@ test('destroy', function() {
});
test('enableDisable', function() {
+ expect( 33 );
var inl, dp,
inp = init('#inp');
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 3e200ecaa..a01b9c7e0 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -7,6 +7,7 @@
module("datepicker: options");
test('setDefaults', function() {
+ expect( 3 );
var inp = init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'});
@@ -16,6 +17,7 @@ test('setDefaults', function() {
});
test('option', function() {
+ expect( 17 );
var inp = init('#inp'),
inst = $.data(inp[0], PROP_NAME);
// Set option
@@ -47,6 +49,7 @@ test('option', function() {
});
test('change', function() {
+ expect( 12 );
var inp = init('#inp'),
inst = $.data(inp[0], PROP_NAME);
equal(inst.settings.showOn, null, 'Initial setting showOn');
@@ -67,6 +70,7 @@ test('change', function() {
});
test('invocation', function() {
+ expect( 29 );
var button, image,
inp = init('#inp'),
dp = $('#ui-datepicker-div'),
@@ -138,6 +142,7 @@ test('invocation', function() {
});
test('otherMonths', function() {
+ expect( 8 );
var inp = init('#inp'),
pop = $('#ui-datepicker-div');
inp.val('06/01/2009').datepicker('show');
@@ -159,6 +164,7 @@ test('otherMonths', function() {
});
test('defaultDate', function() {
+ expect( 17 );
var inp = init('#inp'),
date = new Date();
inp.val('').datepicker('show').
@@ -253,6 +259,7 @@ test('defaultDate', function() {
});
test('miscellaneous', function() {
+ expect( 19 );
var curYear, longNames, shortNames, date,
dp = $('#ui-datepicker-div'),
inp = init('#inp');
@@ -314,6 +321,7 @@ test('miscellaneous', function() {
});
test('minMax', function() {
+ expect( 17 );
var date,
inp = init('#inp'),
lastYear = new Date(2007, 6 - 1, 4),
@@ -398,6 +406,7 @@ test('minMax', function() {
});
test('setDate', function() {
+ expect( 24 );
var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
inp = init('#inp'),
date1 = new Date(2008, 6 - 1, 4),
@@ -477,6 +486,7 @@ test('setDate', function() {
});
test('altField', function() {
+ expect( 10 );
var inp = init('#inp'),
alt = $('#alt');
// No alternate field set
@@ -515,6 +525,7 @@ test('altField', function() {
});
test('autoSize', function() {
+ expect( 15 );
var inp = init('#inp');
equal(inp.prop('size'), 20, 'Auto size - default');
inp.datepicker('option', 'autoSize', true);
@@ -550,6 +561,7 @@ test('autoSize', function() {
});
test('daylightSaving', function() {
+ expect( 25 );
var inp = init('#inp'),
dp = $('#ui-datepicker-div');
ok(true, 'Daylight saving - ' + new Date());
@@ -664,6 +676,7 @@ function calcWeek(date) {
}
test('callbacks', function() {
+ expect( 13 );
// Before show
var dp, day20, day21,
inp = init('#inp', {beforeShow: beforeAll}),
@@ -693,6 +706,7 @@ test('callbacks', function() {
});
test('localisation', function() {
+ expect( 24 );
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');
@@ -722,6 +736,7 @@ test('localisation', function() {
});
test('noWeekends', function() {
+ expect( 31 );
var i, date;
for (i = 1; i <= 31; i++) {
date = new Date(2001, 1 - 1, i);
@@ -731,6 +746,7 @@ test('noWeekends', function() {
});
test('iso8601Week', function() {
+ expect( 12 );
var date = new Date(2000, 12 - 1, 31);
equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date);
date = new Date(2001, 1 - 1, 1);
@@ -758,6 +774,7 @@ test('iso8601Week', function() {
});
test('parseDate', function() {
+ expect( 26 );
init('#inp');
var currentYear, gmtDate, fr, settings, zh;
ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
@@ -822,6 +839,7 @@ test('parseDate', function() {
});
test('parseDateErrors', function() {
+ expect( 17 );
init('#inp');
var fr, settings;
function expectError(expr, value, error) {
@@ -874,6 +892,7 @@ test('parseDateErrors', function() {
});
test('formatDate', function() {
+ expect( 16 );
init('#inp');
var gmtDate, fr, settings;
equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),
diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js
index 105be63a6..e1b882a89 100644
--- a/tests/unit/datepicker/datepicker_tickets.js
+++ b/tests/unit/datepicker/datepicker_tickets.js
@@ -7,6 +7,7 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
+ expect( 3 );
var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
@@ -25,6 +26,7 @@ test('beforeShowDay-getDate', function() {
});
test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler', function(){
+ expect( 3 );
var inp = init('#inp',{
beforeShow: function(){
return false;
@@ -58,11 +60,13 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler'
});
test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){
+ expect( 1 );
var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT"));
equal(time, "089");
});
test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
+ expect( 4 );
var date;
try{
date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');