diff options
author | Leif Johansson <leifj@sunet.se> | 2011-11-25 21:18:19 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-11-25 21:18:19 +0100 |
commit | 3909e6d89e01e4cd8777377c63037896bb95aa2f (patch) | |
tree | 59679df287c2bee55087fb5afb8d42e7f93a44fb /src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js | |
parent | e5f94e9be5017f627c1ccd8c6306c5cc2e200432 (diff) |
new jq layout
Diffstat (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js')
-rw-r--r-- | src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js new file mode 100644 index 0000000..3534266 --- /dev/null +++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/datepicker/datepicker_tickets.js @@ -0,0 +1,84 @@ +/* + * datepicker_tickets.js + */ +(function($) { + +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'); + inp.val('01/01/2010').datepicker('show'); + // contains non-breaking space + equals($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); + $('a.ui-datepicker-next', dp).click(); + $('a.ui-datepicker-next', dp).click(); + // contains non-breaking space + equals($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); + inp.datepicker('hide').datepicker('show'); + $('a.ui-datepicker-prev', dp).click(); + $('a.ui-datepicker-prev', dp).click(); + // contains non-breaking space + equals($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); + inp.datepicker('hide'); +}); + +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'); + inp.datepicker('show'); + equals(dp.css('display'), 'none',"beforeShow returns false"); + inp.datepicker('destroy'); + + inp = init('#inp',{ + beforeShow: function(){ + } + }); + dp = $('#ui-datepicker-div'); + inp.datepicker('show'); + equal(dp.css('display'), 'block',"beforeShow returns nothing"); + inp.datepicker('hide'); + inp.datepicker('destroy'); + + inp = init('#inp',{ + beforeShow: function(){ + return true; + } + }); + dp = $('#ui-datepicker-div'); + inp.datepicker('show'); + equal(dp.css('display'), 'block',"beforeShow returns true"); + inp.datepicker('hide'); + inp.datepicker('destroy'); +}); + +test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){ + var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); + equals(time, "089"); +}); + +test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() { + var date; + try{ + date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881'); + ok(false, "Did not properly detect an invalid date"); + }catch(e){ + ok("invalid date detected"); + } + + try { + date = $.datepicker.parseDate('dd/mm/yy', '18/04/1988 @ 2:43 pm'); + equal(date.getDate(), 18); + equal(date.getMonth(), 3); + equal(date.getFullYear(), 1988); + } catch(e) { + ok(false, "Did not properly parse date with extra text separated by whitespace"); + } +}); + +})(jQuery); |