aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorKarl Kirch <karl.ctr.kirch@faa.gov>2011-08-09 09:55:50 -0400
committerScott González <scott.gonzalez@gmail.com>2011-08-09 09:58:13 -0400
commit1b5af10bb1f4602885ea7be41262d3cd7e72adc4 (patch)
treef6db8d7571c521391e45daeffa13a5412bc84650 /tests/unit
parentc5799b51415cd6c855a05028bf55abe69f570313 (diff)
downloadjquery-ui-1b5af10bb1f4602885ea7be41262d3cd7e72adc4.tar.gz
jquery-ui-1b5af10bb1f4602885ea7be41262d3cd7e72adc4.zip
Datepicker: Added ability to stop datepicker from beforeShow. Fixes #7602 - Ability to stop datepicker from appearing with beforeShow event handler.
(cherry picked from commit d14629735648fb10403e38eac2b764ce6adf56c9)
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/datepicker/datepicker_tickets.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js
index c7fde60de..6edff64e8 100644
--- a/tests/unit/datepicker/datepicker_tickets.js
+++ b/tests/unit/datepicker/datepicker_tickets.js
@@ -29,6 +29,39 @@ test('beforeShowDay-getDate', function() {
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");