aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCa-Phun Ung <pazu2k@gmail.com>2008-12-22 15:47:35 +0000
committerCa-Phun Ung <pazu2k@gmail.com>2008-12-22 15:47:35 +0000
commit3522a23b507f049a8917401bd6acaa928ae37ed8 (patch)
treec8e1964ec7acc11dbbd035fa88e28627546b68f1 /tests
parentbc5df7412cd3a3ce21a4ba2c87242fe92a78e227 (diff)
downloadjquery-ui-3522a23b507f049a8917401bd6acaa928ae37ed8.tar.gz
jquery-ui-3522a23b507f049a8917401bd6acaa928ae37ed8.zip
Datepicker #3647: added enable, disable, destroy buttons to visual test. Fixed failing localisation tests. Fixed RTL support and selected day highlighting for keyboard navigation.
Diffstat (limited to 'tests')
-rw-r--r--tests/datepicker.js10
-rw-r--r--tests/visual/datepicker.html53
2 files changed, 57 insertions, 6 deletions
diff --git a/tests/datepicker.js b/tests/datepicker.js
index 71bbaa950..7ae71fc9e 100644
--- a/tests/datepicker.js
+++ b/tests/datepicker.js
@@ -423,6 +423,7 @@ test('enableDisable', function() {
inp.datepicker('destroy');
// Inline
var inl = init('#inl');
+ var dp = $('.ui-datepicker-inline', inl);
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
ok($('.ui-datepicker-disabled', inl).length == 0, 'Enable/disable inline - cover initially absent');
inl.datepicker('disable');
@@ -1185,24 +1186,21 @@ test('events', function() {
test('localisation', function() {
var inp = init('#inp', $.datepicker.regional['fr']);
- inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true}).val('').datepicker('show');
+ inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show');
var dp = $('#ui-datepicker-div');
equals($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close');
$('.ui-datepicker-close', dp).simulate('mouseover');
equals($('.ui-datepicker-prev', dp).text(), '<Préc', 'Localisation - previous');
equals($('.ui-datepicker-current', dp).text(), 'Courant', 'Localisation - current');
equals($('.ui-datepicker-next', dp).text(), 'Suiv>', 'Localisation - next');
- equals($('.ui-datepicker-current', dp).text(), 'Courant', 'Localisation - current');
var month = 0;
- $('.ui-datepicker-new-month option', dp).each(function() {
+ $('.ui-datepicker-month option', dp).each(function() {
equals($(this).text(), $.datepicker.regional['fr'].monthNames[month],
'Localisation - month ' + month);
month++;
});
- equals($('.ui-datepicker-calendar th:first', dp).text(),
- $.datepicker.regional['fr'].weekHeader, 'Localisation - week header');
var day = 1;
- $('.ui-datepicker-calendar th a', dp).each(function() {
+ $('.ui-datepicker-calendar th', dp).each(function() {
equals($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day],
'Localisation - day ' + day);
day = (day + 1) % 7;
diff --git a/tests/visual/datepicker.html b/tests/visual/datepicker.html
index 214c2c8e5..34b85c86e 100644
--- a/tests/visual/datepicker.html
+++ b/tests/visual/datepicker.html
@@ -9,9 +9,50 @@
<script type="text/javascript" src="../../ui/ui.datepicker.js"></script>
<script type="text/javascript">
$(function() {
+ // simple datepicker
$('#d1').datepicker();
+ $('button.disable-d1').click(function(event){
+ $('#d1').datepicker('disable');
+ event.preventDefault();
+ });
+ $('button.enable-d1').click(function(event){
+ $('#d1').datepicker('enable');
+ event.preventDefault();
+ });
+ $('button.destroy-d1').click(function(event){
+ $('#d1').datepicker('destroy');
+ event.preventDefault();
+ });
+
+ // multi datepicker
$('#d2').datepicker({numberOfMonths: 3, showButtonPanel: true});
+ $('button.disable-d2').click(function(event){
+ $('#d2').datepicker('disable');
+ event.preventDefault();
+ });
+ $('button.enable-d2').click(function(event){
+ $('#d2').datepicker('enable');
+ event.preventDefault();
+ });
+ $('button.destroy-d2').click(function(event){
+ $('#d2').datepicker('destroy');
+ event.preventDefault();
+ });
+
+ // inline datepicker
$('#inl').datepicker();
+ $('button.disable-inl').click(function(event){
+ $('#inl').datepicker('disable');
+ event.preventDefault();
+ });
+ $('button.enable-inl').click(function(event){
+ $('#inl').datepicker('enable');
+ event.preventDefault();
+ });
+ $('button.destroy-inl').click(function(event){
+ $('#inl').datepicker('destroy');
+ event.preventDefault();
+ });
});
</script>
</head>
@@ -19,18 +60,30 @@
<ul class="plugins">
<li class="plugin">
+ <button class="disable-d1">Disable</button>
+ <button class="enable-d1">Enable</button>
+ <button class="destroy-d1">Destroy</button>
+
Datepicker Simple
<div>
<input type="text" id="d1">
</div>
</li>
<li class="plugin">
+ <button class="disable-d2">Disable</button>
+ <button class="enable-d2">Enable</button>
+ <button class="destroy-d2">Destroy</button>
+
Datepicker Multi
<div>
<input type="text" id="d2">
</div>
</li>
<li class="plugin">
+ <button class="disable-inl">Disable</button>
+ <button class="enable-inl">Enable</button>
+ <button class="destroy-inl">Destroy</button>
+
Datepicker Inline
<div id="inl"></div>
</li>