Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into selectmenu

  • Loading branch information...
commit 1ba02e9c5fc96bfcdd82e6a72369f54a30a47ecb 2 parents 2eb9223 + 18b8ffd
@fnagel fnagel authored
Showing with 2,966 additions and 2,984 deletions.
  1. +11 −3 demos/tabs/manipulation.html
  2. +1 −0  tests/.jshintrc
  3. +4 −0 tests/unit/accordion/accordion.html
  4. +0 −1  tests/unit/button/button.html
  5. +128 −128 tests/unit/core/selector.js
  6. +329 −329 tests/unit/datepicker/datepicker_core.js
  7. +87 −87 tests/unit/datepicker/datepicker_events.js
  8. +102 −102 tests/unit/datepicker/datepicker_methods.js
  9. +714 −714 tests/unit/datepicker/datepicker_options.js
  10. +4 −4 tests/unit/datepicker/datepicker_test_helpers.js
  11. +0 −1  tests/unit/dialog/dialog.html
  12. +6 −6 tests/unit/dialog/dialog_common.js
  13. +4 −4 tests/unit/dialog/dialog_core.js
  14. +0 −1  tests/unit/dialog/dialog_deprecated.html
  15. +36 −26 tests/unit/dialog/dialog_deprecated.js
  16. +92 −92 tests/unit/dialog/dialog_events.js
  17. +54 −54 tests/unit/dialog/dialog_methods.js
  18. +167 −156 tests/unit/dialog/dialog_options.js
  19. +8 −8 tests/unit/dialog/dialog_test_helpers.js
  20. +12 −12 tests/unit/draggable/draggable_core.js
  21. +2 −2 tests/unit/draggable/draggable_events.js
  22. +27 −27 tests/unit/draggable/draggable_methods.js
  23. +135 −245 tests/unit/draggable/draggable_options.js
  24. +7 −7 tests/unit/draggable/draggable_test_helpers.js
  25. +6 −6 tests/unit/droppable/droppable_core.js
  26. +19 −19 tests/unit/droppable/droppable_methods.js
  27. +2 −2 tests/unit/droppable/droppable_test_helpers.js
  28. +4 −1 tests/unit/menu/menu_options.js
  29. +1 −1  tests/unit/qunit-composite.js
  30. +5 −5 tests/unit/resizable/resizable_common.js
  31. +20 −20 tests/unit/resizable/resizable_core.js
  32. +16 −16 tests/unit/resizable/resizable_options.js
  33. +0 −1  tests/unit/selectable/selectable.html
  34. +5 −5 tests/unit/selectable/selectable_common.js
  35. +28 −0 tests/unit/selectable/selectable_events.js
  36. +19 −19 tests/unit/selectable/selectable_methods.js
  37. +1 −1  tests/unit/selectable/selectable_options.js
  38. +2 −2 tests/unit/slider/slider_common.js
  39. +32 −32 tests/unit/slider/slider_core.js
  40. +43 −43 tests/unit/slider/slider_methods.js
  41. +20 −20 tests/unit/slider/slider_options.js
  42. +0 −1  tests/unit/sortable/sortable.html
  43. +63 −63 tests/unit/sortable/sortable_events.js
  44. +25 −25 tests/unit/sortable/sortable_methods.js
  45. +15 −15 tests/unit/spinner/spinner_events.js
  46. +11 −4 tests/unit/spinner/spinner_options.js
  47. +4 −4 themes/base/jquery.ui.theme.css
  48. +1 −0  ui/.jshintrc
  49. +4 −4 ui/jquery.ui.core.js
  50. +405 −405 ui/jquery.ui.datepicker.js
  51. +1 −1  ui/jquery.ui.dialog.js
  52. +56 −56 ui/jquery.ui.draggable.js
  53. +23 −23 ui/jquery.ui.droppable.js
  54. +1 −1  ui/jquery.ui.effect-transfer.js
  55. +1 −1  ui/jquery.ui.effect.js
  56. +15 −5 ui/jquery.ui.menu.js
  57. +15 −15 ui/jquery.ui.mouse.js
  58. +70 −70 ui/jquery.ui.resizable.js
  59. +27 −27 ui/jquery.ui.selectable.js
  60. +60 −60 ui/jquery.ui.sortable.js
  61. +16 −2 ui/jquery.ui.spinner.js
View
14 demos/tabs/manipulation.html
@@ -24,7 +24,7 @@
$(function() {
var tabTitle = $( "#tab_title" ),
tabContent = $( "#tab_content" ),
- tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>",
+ tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>",
tabCounter = 2;
var tabs = $( "#tabs" ).tabs();
@@ -75,11 +75,19 @@
});
// close icon: removing the tab on click
- $( "#tabs span.ui-icon-close" ).live( "click", function() {
+ tabs.delegate( "span.ui-icon-close", "click", function() {
var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
$( "#" + panelId ).remove();
tabs.tabs( "refresh" );
});
+
+ tabs.bind( "keyup", function( event ) {
+ if ( event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE ) {
+ var panelId = tabs.find( ".ui-tabs-active" ).remove().attr( "aria-controls" );
+ $( "#" + panelId ).remove();
+ tabs.tabs( "refresh" );
+ }
+ });
});
</script>
</head>
@@ -100,7 +108,7 @@
<div id="tabs">
<ul>
- <li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>
+ <li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close" role="presentation">Remove Tab</span></li>
</ul>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
View
1  tests/.jshintrc
@@ -9,6 +9,7 @@
"latedef": true,
"noarg": true,
"onevar": true,
+ "quotmark": "double",
"trailing": true,
"undef": true,
"unused": true,
View
4 tests/unit/accordion/accordion.html
@@ -35,6 +35,10 @@
font-size: 12px;
line-height: 15px;
}
+ /* avoid IE7 oscillating between overflow visible and scroll values */
+ #list1 > div {
+ overflow: visible;
+ }
</style>
</head>
<body>
View
1  tests/unit/button/button.html
@@ -25,7 +25,6 @@
<script src="button_events.js"></script>
<script src="button_methods.js"></script>
<script src="button_options.js"></script>
- <script src="button_tickets.js"></script>
<script src="../swarminject.js"></script>
</head>
View
256 tests/unit/core/selector.js
@@ -6,19 +6,19 @@
module("core - selectors");
function isFocusable(selector, msg) {
- QUnit.push($(selector).is(':focusable'), null, null, msg + " - selector " + selector + " is focusable");
+ QUnit.push($(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is focusable");
}
function isNotFocusable(selector, msg) {
- QUnit.push($(selector).length && !$(selector).is(':focusable'), null, null, msg + " - selector " + selector + " is not focusable");
+ QUnit.push($(selector).length && !$(selector).is(":focusable"), null, null, msg + " - selector " + selector + " is not focusable");
}
function isTabbable(selector, msg) {
- QUnit.push($(selector).is(':tabbable'), null, null, msg + " - selector " + selector + " is tabbable");
+ QUnit.push($(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is tabbable");
}
function isNotTabbable(selector, msg) {
- QUnit.push($(selector).length && !$(selector).is(':tabbable'), null, null, msg + " - selector " + selector + " is not tabbable");
+ QUnit.push($(selector).length && !$(selector).is(":tabbable"), null, null, msg + " - selector " + selector + " is not tabbable");
}
test("data", function() {
@@ -26,135 +26,135 @@ test("data", function() {
var el;
function shouldHaveData(msg) {
- ok(el.is(':data(test)'), msg);
+ ok(el.is(":data(test)"), msg);
}
function shouldNotHaveData(msg) {
- ok(!el.is(':data(test)'), msg);
+ ok(!el.is(":data(test)"), msg);
}
- el = $('<div>');
- shouldNotHaveData('data never set');
+ el = $("<div>");
+ shouldNotHaveData("data never set");
- el = $('<div>').data('test', null);
- shouldNotHaveData('data is null');
+ el = $("<div>").data("test", null);
+ shouldNotHaveData("data is null");
- el = $('<div>').data('test', true);
- shouldHaveData('data set to true');
+ el = $("<div>").data("test", true);
+ shouldHaveData("data set to true");
- el = $('<div>').data('test', false);
- shouldNotHaveData('data set to false');
+ el = $("<div>").data("test", false);
+ shouldNotHaveData("data set to false");
- el = $('<div>').data('test', 0);
- shouldNotHaveData('data set to 0');
+ el = $("<div>").data("test", 0);
+ shouldNotHaveData("data set to 0");
- el = $('<div>').data('test', 1);
- shouldHaveData('data set to 1');
+ el = $("<div>").data("test", 1);
+ shouldHaveData("data set to 1");
- el = $('<div>').data('test', '');
- shouldNotHaveData('data set to empty string');
+ el = $("<div>").data("test", "");
+ shouldNotHaveData("data set to empty string");
- el = $('<div>').data('test', 'foo');
- shouldHaveData('data set to string');
+ el = $("<div>").data("test", "foo");
+ shouldHaveData("data set to string");
- el = $('<div>').data('test', []);
- shouldHaveData('data set to empty array');
+ el = $("<div>").data("test", []);
+ shouldHaveData("data set to empty array");
- el = $('<div>').data('test', [1]);
- shouldHaveData('data set to array');
+ el = $("<div>").data("test", [1]);
+ shouldHaveData("data set to array");
- el = $('<div>').data('test', {});
- shouldHaveData('data set to empty object');
+ el = $("<div>").data("test", {});
+ shouldHaveData("data set to empty object");
- el = $('<div>').data('test', {foo: 'bar'});
- shouldHaveData('data set to object');
+ el = $("<div>").data("test", {foo: "bar"});
+ shouldHaveData("data set to object");
- el = $('<div>').data('test', new Date());
- shouldHaveData('data set to date');
+ el = $("<div>").data("test", new Date());
+ shouldHaveData("data set to date");
- el = $('<div>').data('test', /test/);
- shouldHaveData('data set to regexp');
+ el = $("<div>").data("test", /test/);
+ shouldHaveData("data set to regexp");
- el = $('<div>').data('test', function() {});
- shouldHaveData('data set to function');
+ el = $("<div>").data("test", function() {});
+ shouldHaveData("data set to function");
});
test("focusable - visible, enabled elements", function() {
expect(18);
- isNotFocusable('#formNoTabindex', 'form');
- isFocusable('#formTabindex', 'form with tabindex');
- isFocusable('#visibleAncestor-inputTypeNone', 'input, no type');
- isFocusable('#visibleAncestor-inputTypeText', 'input, type text');
- isFocusable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
- isFocusable('#visibleAncestor-inputTypeRadio', 'input, type radio');
- isFocusable('#visibleAncestor-inputTypeButton', 'input, type button');
- isNotFocusable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
- isFocusable('#visibleAncestor-button', 'button');
- isFocusable('#visibleAncestor-select', 'select');
- isFocusable('#visibleAncestor-textarea', 'textarea');
- isFocusable('#visibleAncestor-object', 'object');
- isFocusable('#visibleAncestor-anchorWithHref', 'anchor with href');
- isNotFocusable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
- isNotFocusable('#visibleAncestor-span', 'span');
- isNotFocusable('#visibleAncestor-div', 'div');
- isFocusable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
- isFocusable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
+ isNotFocusable("#formNoTabindex", "form");
+ isFocusable("#formTabindex", "form with tabindex");
+ isFocusable("#visibleAncestor-inputTypeNone", "input, no type");
+ isFocusable("#visibleAncestor-inputTypeText", "input, type text");
+ isFocusable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
+ isFocusable("#visibleAncestor-inputTypeRadio", "input, type radio");
+ isFocusable("#visibleAncestor-inputTypeButton", "input, type button");
+ isNotFocusable("#visibleAncestor-inputTypeHidden", "input, type hidden");
+ isFocusable("#visibleAncestor-button", "button");
+ isFocusable("#visibleAncestor-select", "select");
+ isFocusable("#visibleAncestor-textarea", "textarea");
+ isFocusable("#visibleAncestor-object", "object");
+ isFocusable("#visibleAncestor-anchorWithHref", "anchor with href");
+ isNotFocusable("#visibleAncestor-anchorWithoutHref", "anchor without href");
+ isNotFocusable("#visibleAncestor-span", "span");
+ isNotFocusable("#visibleAncestor-div", "div");
+ isFocusable("#visibleAncestor-spanWithTabindex", "span with tabindex");
+ isFocusable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
});
test("focusable - disabled elements", function() {
expect(9);
- isNotFocusable('#disabledElement-inputTypeNone', 'input, no type');
- isNotFocusable('#disabledElement-inputTypeText', 'input, type text');
- isNotFocusable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
- isNotFocusable('#disabledElement-inputTypeRadio', 'input, type radio');
- isNotFocusable('#disabledElement-inputTypeButton', 'input, type button');
- isNotFocusable('#disabledElement-inputTypeHidden', 'input, type hidden');
- isNotFocusable('#disabledElement-button', 'button');
- isNotFocusable('#disabledElement-select', 'select');
- isNotFocusable('#disabledElement-textarea', 'textarea');
+ isNotFocusable("#disabledElement-inputTypeNone", "input, no type");
+ isNotFocusable("#disabledElement-inputTypeText", "input, type text");
+ isNotFocusable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
+ isNotFocusable("#disabledElement-inputTypeRadio", "input, type radio");
+ isNotFocusable("#disabledElement-inputTypeButton", "input, type button");
+ isNotFocusable("#disabledElement-inputTypeHidden", "input, type hidden");
+ isNotFocusable("#disabledElement-button", "button");
+ isNotFocusable("#disabledElement-select", "select");
+ isNotFocusable("#disabledElement-textarea", "textarea");
});
test("focusable - hidden styles", function() {
expect(8);
- isNotFocusable('#displayNoneAncestor-input', 'input, display: none parent');
- isNotFocusable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
+ isNotFocusable("#displayNoneAncestor-input", "input, display: none parent");
+ isNotFocusable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
- isNotFocusable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
- isNotFocusable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
+ isNotFocusable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
+ isNotFocusable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
- isNotFocusable('#displayNone-input', 'input, display: none');
- isNotFocusable('#visibilityHidden-input', 'input, visibility: hidden');
+ isNotFocusable("#displayNone-input", "input, display: none");
+ isNotFocusable("#visibilityHidden-input", "input, visibility: hidden");
- isNotFocusable('#displayNone-span', 'span with tabindex, display: none');
- isNotFocusable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
+ isNotFocusable("#displayNone-span", "span with tabindex, display: none");
+ isNotFocusable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
});
test("focusable - natively focusable with various tabindex", function() {
expect(4);
- isFocusable('#inputTabindex0', 'input, tabindex 0');
- isFocusable('#inputTabindex10', 'input, tabindex 10');
- isFocusable('#inputTabindex-1', 'input, tabindex -1');
- isFocusable('#inputTabindex-50', 'input, tabindex -50');
+ isFocusable("#inputTabindex0", "input, tabindex 0");
+ isFocusable("#inputTabindex10", "input, tabindex 10");
+ isFocusable("#inputTabindex-1", "input, tabindex -1");
+ isFocusable("#inputTabindex-50", "input, tabindex -50");
});
test("focusable - not natively focusable with various tabindex", function() {
expect(4);
- isFocusable('#spanTabindex0', 'span, tabindex 0');
- isFocusable('#spanTabindex10', 'span, tabindex 10');
- isFocusable('#spanTabindex-1', 'span, tabindex -1');
- isFocusable('#spanTabindex-50', 'span, tabindex -50');
+ isFocusable("#spanTabindex0", "span, tabindex 0");
+ isFocusable("#spanTabindex10", "span, tabindex 10");
+ isFocusable("#spanTabindex-1", "span, tabindex -1");
+ isFocusable("#spanTabindex-50", "span, tabindex -50");
});
test("focusable - area elements", function() {
expect( 3 );
- isFocusable('#areaCoordsHref', 'coords and href');
- isFocusable('#areaNoCoordsHref', 'href but no coords');
- isNotFocusable('#areaNoImg', 'not associated with an image');
+ isFocusable("#areaCoordsHref", "coords and href");
+ isFocusable("#areaNoCoordsHref", "href but no coords");
+ isNotFocusable("#areaNoImg", "not associated with an image");
});
test( "focusable - dimensionless parent with overflow", function() {
@@ -166,80 +166,80 @@ test( "focusable - dimensionless parent with overflow", function() {
test("tabbable - visible, enabled elements", function() {
expect(18);
- isNotTabbable('#formNoTabindex', 'form');
- isTabbable('#formTabindex', 'form with tabindex');
- isTabbable('#visibleAncestor-inputTypeNone', 'input, no type');
- isTabbable('#visibleAncestor-inputTypeText', 'input, type text');
- isTabbable('#visibleAncestor-inputTypeCheckbox', 'input, type checkbox');
- isTabbable('#visibleAncestor-inputTypeRadio', 'input, type radio');
- isTabbable('#visibleAncestor-inputTypeButton', 'input, type button');
- isNotTabbable('#visibleAncestor-inputTypeHidden', 'input, type hidden');
- isTabbable('#visibleAncestor-button', 'button');
- isTabbable('#visibleAncestor-select', 'select');
- isTabbable('#visibleAncestor-textarea', 'textarea');
- isTabbable('#visibleAncestor-object', 'object');
- isTabbable('#visibleAncestor-anchorWithHref', 'anchor with href');
- isNotTabbable('#visibleAncestor-anchorWithoutHref', 'anchor without href');
- isNotTabbable('#visibleAncestor-span', 'span');
- isNotTabbable('#visibleAncestor-div', 'div');
- isTabbable("#visibleAncestor-spanWithTabindex", 'span with tabindex');
- isNotTabbable("#visibleAncestor-divWithNegativeTabindex", 'div with tabindex');
+ isNotTabbable("#formNoTabindex", "form");
+ isTabbable("#formTabindex", "form with tabindex");
+ isTabbable("#visibleAncestor-inputTypeNone", "input, no type");
+ isTabbable("#visibleAncestor-inputTypeText", "input, type text");
+ isTabbable("#visibleAncestor-inputTypeCheckbox", "input, type checkbox");
+ isTabbable("#visibleAncestor-inputTypeRadio", "input, type radio");
+ isTabbable("#visibleAncestor-inputTypeButton", "input, type button");
+ isNotTabbable("#visibleAncestor-inputTypeHidden", "input, type hidden");
+ isTabbable("#visibleAncestor-button", "button");
+ isTabbable("#visibleAncestor-select", "select");
+ isTabbable("#visibleAncestor-textarea", "textarea");
+ isTabbable("#visibleAncestor-object", "object");
+ isTabbable("#visibleAncestor-anchorWithHref", "anchor with href");
+ isNotTabbable("#visibleAncestor-anchorWithoutHref", "anchor without href");
+ isNotTabbable("#visibleAncestor-span", "span");
+ isNotTabbable("#visibleAncestor-div", "div");
+ isTabbable("#visibleAncestor-spanWithTabindex", "span with tabindex");
+ isNotTabbable("#visibleAncestor-divWithNegativeTabindex", "div with tabindex");
});
test("tabbable - disabled elements", function() {
expect(9);
- isNotTabbable('#disabledElement-inputTypeNone', 'input, no type');
- isNotTabbable('#disabledElement-inputTypeText', 'input, type text');
- isNotTabbable('#disabledElement-inputTypeCheckbox', 'input, type checkbox');
- isNotTabbable('#disabledElement-inputTypeRadio', 'input, type radio');
- isNotTabbable('#disabledElement-inputTypeButton', 'input, type button');
- isNotTabbable('#disabledElement-inputTypeHidden', 'input, type hidden');
- isNotTabbable('#disabledElement-button', 'button');
- isNotTabbable('#disabledElement-select', 'select');
- isNotTabbable('#disabledElement-textarea', 'textarea');
+ isNotTabbable("#disabledElement-inputTypeNone", "input, no type");
+ isNotTabbable("#disabledElement-inputTypeText", "input, type text");
+ isNotTabbable("#disabledElement-inputTypeCheckbox", "input, type checkbox");
+ isNotTabbable("#disabledElement-inputTypeRadio", "input, type radio");
+ isNotTabbable("#disabledElement-inputTypeButton", "input, type button");
+ isNotTabbable("#disabledElement-inputTypeHidden", "input, type hidden");
+ isNotTabbable("#disabledElement-button", "button");
+ isNotTabbable("#disabledElement-select", "select");
+ isNotTabbable("#disabledElement-textarea", "textarea");
});
test("tabbable - hidden styles", function() {
expect(8);
- isNotTabbable('#displayNoneAncestor-input', 'input, display: none parent');
- isNotTabbable('#displayNoneAncestor-span', 'span with tabindex, display: none parent');
+ isNotTabbable("#displayNoneAncestor-input", "input, display: none parent");
+ isNotTabbable("#displayNoneAncestor-span", "span with tabindex, display: none parent");
- isNotTabbable('#visibilityHiddenAncestor-input', 'input, visibility: hidden parent');
- isNotTabbable('#visibilityHiddenAncestor-span', 'span with tabindex, visibility: hidden parent');
+ isNotTabbable("#visibilityHiddenAncestor-input", "input, visibility: hidden parent");
+ isNotTabbable("#visibilityHiddenAncestor-span", "span with tabindex, visibility: hidden parent");
- isNotTabbable('#displayNone-input', 'input, display: none');
- isNotTabbable('#visibilityHidden-input', 'input, visibility: hidden');
+ isNotTabbable("#displayNone-input", "input, display: none");
+ isNotTabbable("#visibilityHidden-input", "input, visibility: hidden");
- isNotTabbable('#displayNone-span', 'span with tabindex, display: none');
- isNotTabbable('#visibilityHidden-span', 'span with tabindex, visibility: hidden');
+ isNotTabbable("#displayNone-span", "span with tabindex, display: none");
+ isNotTabbable("#visibilityHidden-span", "span with tabindex, visibility: hidden");
});
test("tabbable - natively tabbable with various tabindex", function() {
expect(4);
- isTabbable('#inputTabindex0', 'input, tabindex 0');
- isTabbable('#inputTabindex10', 'input, tabindex 10');
- isNotTabbable('#inputTabindex-1', 'input, tabindex -1');
- isNotTabbable('#inputTabindex-50', 'input, tabindex -50');
+ isTabbable("#inputTabindex0", "input, tabindex 0");
+ isTabbable("#inputTabindex10", "input, tabindex 10");
+ isNotTabbable("#inputTabindex-1", "input, tabindex -1");
+ isNotTabbable("#inputTabindex-50", "input, tabindex -50");
});
test("tabbable - not natively tabbable with various tabindex", function() {
expect(4);
- isTabbable('#spanTabindex0', 'span, tabindex 0');
- isTabbable('#spanTabindex10', 'span, tabindex 10');
- isNotTabbable('#spanTabindex-1', 'span, tabindex -1');
- isNotTabbable('#spanTabindex-50', 'span, tabindex -50');
+ isTabbable("#spanTabindex0", "span, tabindex 0");
+ isTabbable("#spanTabindex10", "span, tabindex 10");
+ isNotTabbable("#spanTabindex-1", "span, tabindex -1");
+ isNotTabbable("#spanTabindex-50", "span, tabindex -50");
});
test("tabbable - area elements", function() {
expect( 3 );
- isTabbable('#areaCoordsHref', 'coords and href');
- isTabbable('#areaNoCoordsHref', 'href but no coords');
- isNotTabbable('#areaNoImg', 'not associated with an image');
+ isTabbable("#areaCoordsHref", "coords and href");
+ isTabbable("#areaNoCoordsHref", "href but no coords");
+ isNotTabbable("#areaNoImg", "not associated with an image");
});
test( "tabbable - dimensionless parent with overflow", function() {
View
658 tests/unit/datepicker/datepicker_core.js
@@ -10,12 +10,12 @@ TestHelpers.testJshint( "datepicker" );
test("initialization - Reinitialization after body had been emptied.", function() {
expect( 1 );
- var bodyContent = $('body').children(), inp = $("#inp");
+ var bodyContent = $("body").children(), inp = $("#inp");
$("#inp").datepicker();
- $('body').empty().append(inp);
+ $("body").empty().append(inp);
$("#inp").datepicker();
ok( $("#"+$.datepicker._mainDivId).length===1, "Datepicker container added" );
- $('body').empty().append(bodyContent); // Returning to initial state for later tests
+ $("body").empty().append(bodyContent); // Returning to initial state for later tests
});
test( "widget method - empty collection", function() {
@@ -30,46 +30,46 @@ test("widget method", function() {
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
});
-asyncTest('baseStructure', function() {
+asyncTest("baseStructure", function() {
expect( 58 );
var header, title, table, thead, week, panel, inl, child,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div');
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div");
function step1() {
inp[0].focus();
setTimeout(function() {
- 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, 'Structure - child count');
-
- 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');
-
- 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');
-
- 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');
- 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');
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ 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, "Structure - child count");
+
+ 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");
+
+ 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");
+
+ 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");
+ 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");
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
step2();
});
@@ -77,19 +77,19 @@ asyncTest('baseStructure', function() {
function step2() {
// Editable month/year and button panel
- inp = TestHelpers.datepicker.init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
+ inp = TestHelpers.datepicker.init("#inp", {changeMonth: true, changeYear: true, showButtonPanel: true});
inp.focus();
setTimeout(function() {
- 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');
+ 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");
- 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');
- ok(panel.children(':last').is('button.ui-datepicker-close'), 'Structure - close button');
- inp.datepicker('hide').datepicker('destroy');
+ 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");
+ ok(panel.children(":last").is("button.ui-datepicker-close"), "Structure - close button");
+ inp.datepicker("hide").datepicker("destroy");
step3();
});
@@ -97,19 +97,19 @@ asyncTest('baseStructure', function() {
function step3() {
// Multi-month 2
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 2});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 2});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
- equal(dp.children().length, 3, 'Structure multi [2] - child count');
- 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');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
- ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi"), "Structure multi [2] - multi-month");
+ equal(dp.children().length, 3, "Structure multi [2] - child count");
+ 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");
+ child = dp.children(":eq(2)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2] - row break");
+ ok(dp.is(".ui-datepicker-multi-2"), "Structure multi [2] - multi-2");
+ inp.datepicker("hide").datepicker("destroy");
step4();
});
@@ -117,12 +117,12 @@ asyncTest('baseStructure', function() {
function step4() {
// Multi-month 3
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 3});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: 3});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
- ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi-3"), "Structure multi [3] - multi-3");
+ ok(! dp.is(".ui-datepicker-multi-2"), "Structure multi [3] - Trac #6704");
+ inp.datepicker("hide").datepicker("destroy");
step5();
});
@@ -130,53 +130,53 @@ asyncTest('baseStructure', function() {
function step5() {
// Multi-month [2, 2]
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: [2, 2]});
+ inp = TestHelpers.datepicker.init("#inp", {numberOfMonths: [2, 2]});
inp.focus();
setTimeout(function() {
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
- equal(dp.children().length, 6, 'Structure multi [2,2] - child count');
- child = dp.children(':first');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,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,2] - second month division');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- child = dp.children(':eq(3)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - third month division');
- child = dp.children(':eq(4)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - fourth month division');
- child = dp.children(':eq(5)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-multi"), "Structure multi - multi-month");
+ equal(dp.children().length, 6, "Structure multi [2,2] - child count");
+ child = dp.children(":first");
+ ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,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,2] - second month division");
+ child = dp.children(":eq(2)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
+ child = dp.children(":eq(3)");
+ ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure multi [2,2] - third month division");
+ child = dp.children(":eq(4)");
+ ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure multi [2,2] - fourth month division");
+ child = dp.children(":eq(5)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure multi [2,2] - row break");
+ inp.datepicker("hide").datepicker("destroy");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
+ inl = TestHelpers.datepicker.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');
- 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');
- 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');
- inl.datepicker('destroy');
+ 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");
+ 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");
+ 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");
+ inl.datepicker("destroy");
// Inline multi-month
- inl = TestHelpers.datepicker.init('#inl', {numberOfMonths: 2});
+ inl = TestHelpers.datepicker.init("#inl", {numberOfMonths: 2});
dp = inl.children();
- ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div');
- equal(dp.children().length, 3, 'Structure inline multi - child count');
- child = dp.children(':first');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure inline multi - first month division');
- child = dp.children(':eq(1)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure inline multi - second month division');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure inline multi - row break');
- inl.datepicker('destroy');
+ ok(dp.is(".ui-datepicker-inline") && dp.is(".ui-datepicker-multi"), "Structure inline multi - main div");
+ equal(dp.children().length, 3, "Structure inline multi - child count");
+ child = dp.children(":first");
+ ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-first"), "Structure inline multi - first month division");
+ child = dp.children(":eq(1)");
+ ok(child.is("div.ui-datepicker-group") && child.is("div.ui-datepicker-group-last"), "Structure inline multi - second month division");
+ child = dp.children(":eq(2)");
+ ok(child.is("div.ui-datepicker-row-break"), "Structure inline multi - row break");
+ inl.datepicker("destroy");
start();
});
@@ -185,279 +185,279 @@ asyncTest('baseStructure', function() {
step1();
});
-test('customStructure', function() {
+test("customStructure", function() {
expect( 20 );
var header, panel, title, thead,
- dp = $('#ui-datepicker-div'),
+ dp = $("#ui-datepicker-div"),
// Check right-to-left localisation
- inp = TestHelpers.datepicker.init('#inp', $.datepicker.regional.he);
- inp.datepicker( 'option', 'showButtonPanel', true);
+ inp = TestHelpers.datepicker.init("#inp", $.datepicker.regional.he);
+ inp.datepicker( "option", "showButtonPanel", true);
inp.focus();
- ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
- 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');
- 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');
- ok(panel.children(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button');
- inp.datepicker('hide').datepicker('destroy');
+ ok(dp.is(".ui-datepicker-rtl"), "Structure RTL - right-to-left");
+ 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");
+ 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");
+ ok(panel.children(":last").is("button.ui-datepicker-current"), "Structure RTL - today button");
+ inp.datepicker("hide").datepicker("destroy");
// Hide prev/next
- inp = TestHelpers.datepicker.init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
- inp.val('02/10/2008').focus();
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
+ inp.val("02/10/2008").focus();
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
// Changeable Month with read-only year
- inp = TestHelpers.datepicker.init('#inp', {changeMonth: true});
+ inp = TestHelpers.datepicker.init("#inp", {changeMonth: true});
inp.focus();
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
// Changeable year with read-only month
- inp = TestHelpers.datepicker.init('#inp', {changeYear: true});
+ inp = TestHelpers.datepicker.init("#inp", {changeYear: true});
inp.focus();
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ 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");
+ inp.datepicker("hide").datepicker("destroy");
// Read-only first day of week
- inp = TestHelpers.datepicker.init('#inp', {changeFirstDay: false});
+ inp = TestHelpers.datepicker.init("#inp", {changeFirstDay: false});
inp.focus();
- 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');
+ 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() {
+test("keystrokes", function() {
expect( 26 );
- var inp = TestHelpers.datepicker.init('#inp'),
+ var inp = TestHelpers.datepicker.init("#inp"),
date = new Date();
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke enter - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
- ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- ok(inp.datepicker('getDate') == null, 'Keystroke esc');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke esc - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke esc - abandoned');
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke enter");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke enter - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+home");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
+ ok(inp.datepicker("getDate") == null, "Keystroke ctrl+end");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ ok(inp.datepicker("getDate") == null, "Keystroke esc");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke esc - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke esc - abandoned");
// Moving by day or week
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.LEFT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+left");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.LEFT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke left");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+right");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.RIGHT}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 1);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke right");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+up");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke up");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke ctrl+down");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() - 7);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Keystroke down");
// Moving by month or year
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
- 'Keystroke pgup');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
- 'Keystroke pgdn');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
- 'Keystroke ctrl+pgup');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
- 'Keystroke ctrl+pgdn');
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 4),
+ "Keystroke pgup");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 4),
+ "Keystroke pgdn");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 4),
+ "Keystroke ctrl+pgup");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 4),
+ "Keystroke ctrl+pgdn");
// Check for moving to short months
- inp.val('03/31/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
- 'Keystroke pgup - Feb');
- inp.val('01/30/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
- 'Keystroke pgdn - Feb');
- inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
- 'Keystroke ctrl+pgup - Feb');
- inp.val('02/29/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
- 'Keystroke ctrl+pgdn - Feb');
+ inp.val("03/31/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ "Keystroke pgup - Feb");
+ inp.val("01/30/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 29),
+ "Keystroke pgdn - Feb");
+ inp.val("02/29/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 2 - 1, 28),
+ "Keystroke ctrl+pgup - Feb");
+ inp.val("02/29/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2009, 2 - 1, 28),
+ "Keystroke ctrl+pgdn - Feb");
// Goto current
- inp.datepicker('option', {gotoCurrent: true}).
- datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Keystroke ctrl+home');
+ inp.datepicker("option", {gotoCurrent: true}).
+ datepicker("hide").val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Keystroke ctrl+home");
// Change steps
- inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
- datepicker('hide').val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
- 'Keystroke pgup step 2');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
- 'Keystroke pgdn step 2');
+ inp.datepicker("option", {stepMonths: 2, gotoCurrent: false}).
+ datepicker("hide").val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2007, 12 - 1, 4),
+ "Keystroke pgup step 2");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 4 - 1, 4),
+ "Keystroke pgdn step 2");
});
-test('mouse', function() {
+test("mouse", function() {
expect( 15 );
var inl,
- inp = TestHelpers.datepicker.init('#inp'),
- dp = $('#ui-datepicker-div'),
+ inp = TestHelpers.datepicker.init("#inp"),
+ dp = $("#ui-datepicker-div"),
date = new Date();
- inp.val('').datepicker('show');
- $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
+ inp.val("").datepicker("show");
+ $(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 12),
- 'Mouse click - preset');
- inp.val('02/04/2008').datepicker('show');
- inp.val('').datepicker('show');
- $('button.ui-datepicker-close', dp).simulate('click', {});
- ok(inp.datepicker('getDate') == null, 'Mouse click - close');
- inp.val('02/04/2008').datepicker('show');
- $('button.ui-datepicker-close', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Mouse click - close + preset');
- inp.val('02/04/2008').datepicker('show');
- $('a.ui-datepicker-prev', dp).simulate('click', {});
- $('button.ui-datepicker-close', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
- 'Mouse click - abandoned');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 12),
+ "Mouse click - preset");
+ inp.val("02/04/2008").datepicker("show");
+ inp.val("").datepicker("show");
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ ok(inp.datepicker("getDate") == null, "Mouse click - close");
+ inp.val("02/04/2008").datepicker("show");
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Mouse click - close + preset");
+ inp.val("02/04/2008").datepicker("show");
+ $("a.ui-datepicker-prev", dp).simulate("click", {});
+ $("button.ui-datepicker-close", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 4),
+ "Mouse click - abandoned");
// Current/previous/next
- inp.val('02/04/2008').datepicker('option', {showButtonPanel: true}).datepicker('show');
- $('.ui-datepicker-current', dp).simulate('click', {});
- $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
+ inp.val("02/04/2008").datepicker("option", {showButtonPanel: true}).datepicker("show");
+ $(".ui-datepicker-current", dp).simulate("click", {});
+ $(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
date.setDate(14);
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), date, 'Mouse click - current');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-prev', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 16),
- 'Mouse click - previous');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-next', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 18),
- 'Mouse click - next');
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), date, "Mouse click - current");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-prev", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 1 - 1, 16),
+ "Mouse click - previous");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-next", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 3 - 1, 18),
+ "Mouse click - next");
// Previous/next with minimum/maximum
- inp.datepicker('option', {minDate: new Date(2008, 2 - 1, 2),
- maxDate: new Date(2008, 2 - 1, 26)}).val('02/04/2008').datepicker('show');
- $('.ui-datepicker-prev', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 16),
- 'Mouse click - previous + min/max');
- inp.val('02/04/2008').datepicker('show');
- $('.ui-datepicker-next', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
- 'Mouse click - next + min/max');
+ inp.datepicker("option", {minDate: new Date(2008, 2 - 1, 2),
+ maxDate: new Date(2008, 2 - 1, 26)}).val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-prev", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 16),
+ "Mouse click - previous + min/max");
+ inp.val("02/04/2008").datepicker("show");
+ $(".ui-datepicker-next", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inp.datepicker("getDate"), new Date(2008, 2 - 1, 18),
+ "Mouse click - next + min/max");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
- dp = $('.ui-datepicker-inline', inl);
+ inl = TestHelpers.datepicker.init("#inl");
+ dp = $(".ui-datepicker-inline", inl);
date = new Date();
- inl.datepicker('setDate', date);
- $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
+ inl.datepicker("setDate", date);
+ $(".ui-datepicker-calendar tbody a:contains(10)", dp).simulate("click", {});
date.setDate(10);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline');
- inl.datepicker('option', {showButtonPanel: true}).datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 2 - 1, 12), 'Mouse click inline - preset');
- inl.datepicker('option', {showButtonPanel: true});
- $('.ui-datepicker-current', dp).simulate('click', {});
- $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline");
+ inl.datepicker("option", {showButtonPanel: true}).datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".ui-datepicker-calendar tbody a:contains(12)", dp).simulate("click", {});
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 2 - 1, 12), "Mouse click inline - preset");
+ inl.datepicker("option", {showButtonPanel: true});
+ $(".ui-datepicker-current", dp).simulate("click", {});
+ $(".ui-datepicker-calendar tbody a:contains(14)", dp).simulate("click", {});
date.setDate(14);
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline - current');
- inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.ui-datepicker-prev', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 1 - 1, 16),
- 'Mouse click inline - previous');
- inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
- $('.ui-datepicker-next', dp).simulate('click');
- $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
- TestHelpers.datepicker.equalsDate(inl.datepicker('getDate'), new Date(2008, 3 - 1, 18),
- 'Mouse click inline - next');
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), date, "Mouse click inline - current");
+ inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".ui-datepicker-prev", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(16)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 1 - 1, 16),
+ "Mouse click inline - previous");
+ inl.datepicker("setDate", new Date(2008, 2 - 1, 4));
+ $(".ui-datepicker-next", dp).simulate("click");
+ $(".ui-datepicker-calendar tbody a:contains(18)", dp).simulate("click");
+ TestHelpers.datepicker.equalsDate(inl.datepicker("getDate"), new Date(2008, 3 - 1, 18),
+ "Mouse click inline - next");
});
})(jQuery);
View
174 tests/unit/datepicker/datepicker_events.js
@@ -17,137 +17,137 @@ function callback(date, inst) {
function callback2(year, month, inst) {
selectedThis = this;
- selectedDate = year + '/' + month;
+ selectedDate = year + "/" + month;
selectedInst = inst;
}
-test('events', function() {
+test("events", function() {
expect( 26 );
var dateStr, newMonthYear, inp2,
- inp = TestHelpers.datepicker.init('#inp', {onSelect: callback}),
+ inp = TestHelpers.datepicker.init("#inp", {onSelect: callback}),
date = new Date();
// onSelect
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(selectedThis, inp[0], 'Callback selected this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback selected inst');
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date');
- inp.val('').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedThis, inp[0], "Callback selected this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback selected inst");
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date");
+ inp.val("").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}).
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
date.setDate(date.getDate() + 7);
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date - ctrl+down');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
- 'Callback selected date - esc');
- dateStr = '02/04/2008';
- inp.val(dateStr).datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date - ctrl+down");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", date),
+ "Callback selected date - esc");
+ dateStr = "02/04/2008";
+ inp.val(dateStr).datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
equal(dateStr, selectedDate,
- 'onSelect is called after enter keydown');
+ "onSelect is called after enter keydown");
// onChangeMonthYear
- inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
- val('').datepicker('show');
+ inp.datepicker("option", {onChangeMonthYear: callback2, onSelect: null}).
+ val("").datepicker("show");
newMonthYear = function(date) {
- return date.getFullYear() + '/' + (date.getMonth() + 1);
+ return date.getFullYear() + "/" + (date.getMonth() + 1);
};
date = new Date();
date.setDate(1);
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
- equal(selectedThis, inp[0], 'Callback change month/year this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback change month/year inst');
+ equal(selectedThis, inp[0], "Callback change month/year this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback change month/year inst");
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - pgup');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year date - pgup");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - pgdn');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
+ "Callback change month/year date - pgdn");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
date.setFullYear(date.getFullYear() - 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+pgup');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
+ "Callback change month/year date - ctrl+pgup");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.HOME});
date.setFullYear(date.getFullYear() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+home');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year date - ctrl+home");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
date.setFullYear(date.getFullYear() + 1);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year date - ctrl+pgdn');
- inp.datepicker('setDate', new Date(2007, 1 - 1, 26));
- equal(selectedDate, '2007/1', 'Callback change month/year date - setDate');
+ "Callback change month/year date - ctrl+pgdn");
+ inp.datepicker("setDate", new Date(2007, 1 - 1, 26));
+ equal(selectedDate, "2007/1", "Callback change month/year date - setDate");
selectedDate = null;
- inp.datepicker('setDate', new Date(2007, 1 - 1, 12));
- ok(selectedDate == null, 'Callback change month/year date - setDate no change');
+ inp.datepicker("setDate", new Date(2007, 1 - 1, 12));
+ ok(selectedDate == null, "Callback change month/year date - setDate no change");
// onChangeMonthYear step by 2
- inp.datepicker('option', {stepMonths: 2}).
- datepicker('hide').val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
+ inp.datepicker("option", {stepMonths: 2}).
+ datepicker("hide").val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 14);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - pgup');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
+ "Callback change month/year by 2 date - pgup");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 12);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - ctrl+pgup');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year by 2 date - ctrl+pgup");
+ inp.simulate("keydown", {keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 2);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - pgdn');
- inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
+ "Callback change month/year by 2 date - pgdn");
+ inp.simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN});
date.setMonth(date.getMonth() + 12);
equal(selectedDate, newMonthYear(date),
- 'Callback change month/year by 2 date - ctrl+pgdn');
+ "Callback change month/year by 2 date - ctrl+pgdn");
// onClose
- inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
- val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedThis, inp[0], 'Callback close this');
- equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Callback close inst');
- equal(selectedDate, '', 'Callback close date - esc');
- inp.val('').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()),
- 'Callback close date - enter');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- equal(selectedDate, '02/04/2008', 'Callback close date - preset');
- inp.val('02/04/2008').datepicker('show').
- simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
- equal(selectedDate, '', 'Callback close date - ctrl+end');
+ inp.datepicker("option", {onClose: callback, onChangeMonthYear: null, stepMonths: 1}).
+ val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedThis, inp[0], "Callback close this");
+ equal(selectedInst, $.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Callback close inst");
+ equal(selectedDate, "", "Callback close date - esc");
+ inp.val("").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ENTER});
+ equal(selectedDate, $.datepicker.formatDate("mm/dd/yy", new Date()),
+ "Callback close date - enter");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
+ equal(selectedDate, "02/04/2008", "Callback close date - preset");
+ inp.val("02/04/2008").datepicker("show").
+ simulate("keydown", {ctrlKey: true, keyCode: $.ui.keyCode.END});
+ equal(selectedDate, "", "Callback close date - ctrl+end");
- inp2 = TestHelpers.datepicker.init('#inp2');
- inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
- inp.datepicker('show');
- equal(selectedThis, inp2[0], 'Callback close this');
+ inp2 = TestHelpers.datepicker.init("#inp2");
+ inp2.datepicker().datepicker("option", {onClose: callback}).datepicker("show");
+ inp.datepicker("show");
+ equal(selectedThis, inp2[0], "Callback close this");
});
-test('beforeShowDay-getDate', function() {
+test("beforeShowDay-getDate", function() {
expect( 3 );
- var inp = TestHelpers.datepicker.init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
- dp = $('#ui-datepicker-div');
- inp.val('01/01/2010').datepicker('show');
+ var inp = TestHelpers.datepicker.init("#inp", {beforeShowDay: function() { 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(),
+ equal($("div.ui-datepicker-title").text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
- $( "<span>January&#xa0;2010</span>" ).text(), 'Initial month');
- $('a.ui-datepicker-next', dp).click();
- $('a.ui-datepicker-next', dp).click();
+ $( "<span>January&#xa0;2010</span>" ).text(), "Initial month");
+ $("a.ui-datepicker-next", dp).click();
+ $("a.ui-datepicker-next", dp).click();
// contains non-breaking space
- equal($('div.ui-datepicker-title').text(),
- $( "<span>March&#xa0;2010</span>" ).text(), 'After next clicks');
- inp.datepicker('hide').datepicker('show');
- $('a.ui-datepicker-prev', dp).click();
- $('a.ui-datepicker-prev', dp).click();
+ equal($("div.ui-datepicker-title").text(),
+ $( "<span>March&#xa0;2010</span>" ).text(), "After next clicks");
+ inp.datepicker("hide").datepicker("show");
+ $("a.ui-datepicker-prev", dp).click();
+ $("a.ui-datepicker-prev", dp).click();
// contains non-breaking space
- equal($('div.ui-datepicker-title').text(),
- $( "<span>November&#xa0;2009</span>" ).text(), 'After prev clicks');
- inp.datepicker('hide');
+ equal($("div.ui-datepicker-title").text(),
+ $( "<span>November&#xa0;2009</span>" ).text(), "After prev clicks");
+ inp.datepicker("hide");
});
})(jQuery);
View
204 tests/unit/datepicker/datepicker_methods.js
@@ -5,121 +5,121 @@
module("datepicker: methods");
-test('destroy', function() {
+test("destroy", function() {
expect( 33 );
var inl,
- inp = TestHelpers.datepicker.init('#inp');
- ok(inp.is('.hasDatepicker'), 'Default - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance present');
- ok(inp.next().is('#alt'), 'Default - button absent');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Default - instance absent');
- ok(inp.next().is('#alt'), 'Default - button absent');
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(inp.is(".hasDatepicker"), "Default - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance present");
+ ok(inp.next().is("#alt"), "Default - button absent");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Default - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Default - instance absent");
+ ok(inp.next().is("#alt"), "Default - button absent");
// With button
- inp= TestHelpers.datepicker.init('#inp', {showOn: 'both'});
- ok(inp.is('.hasDatepicker'), 'Button - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance present');
- ok(inp.next().text() === '...', 'Button - button added');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Button - instance absent');
- ok(inp.next().is('#alt'), 'Button - button removed');
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both"});
+ ok(inp.is(".hasDatepicker"), "Button - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance present");
+ ok(inp.next().text() === "...", "Button - button added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Button - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Button - instance absent");
+ ok(inp.next().is("#alt"), "Button - button removed");
// With append text
- inp = TestHelpers.datepicker.init('#inp', {appendText: 'Testing'});
- ok(inp.is('.hasDatepicker'), 'Append - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance present');
- ok(inp.next().text() === 'Testing', 'Append - append text added');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Append - instance absent');
- ok(inp.next().is('#alt'), 'Append - append text removed');
+ inp = TestHelpers.datepicker.init("#inp", {appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Append - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance present");
+ ok(inp.next().text() === "Testing", "Append - append text added");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Append - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Append - instance absent");
+ ok(inp.next().is("#alt"), "Append - append text removed");
// With both
- inp= TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImageOnly: true,
- buttonImage: 'img/calendar.gif', appendText: 'Testing'});
- ok(inp.is('.hasDatepicker'), 'Both - marker class set');
- ok($.data(inp[0], TestHelpers.datepicker.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');
- inp.datepicker('destroy');
- inp = $('#inp');
- ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
- ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), 'Both - instance absent');
- ok(inp.next().is('#alt'), 'Both - button and append text absent');
+ inp= TestHelpers.datepicker.init("#inp", {showOn: "both", buttonImageOnly: true,
+ buttonImage: "img/calendar.gif", appendText: "Testing"});
+ ok(inp.is(".hasDatepicker"), "Both - marker class set");
+ ok($.data(inp[0], TestHelpers.datepicker.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");
+ inp.datepicker("destroy");
+ inp = $("#inp");
+ ok(!inp.is(".hasDatepicker"), "Both - marker class cleared");
+ ok(!$.data(inp[0], TestHelpers.datepicker.PROP_NAME), "Both - instance absent");
+ ok(inp.next().is("#alt"), "Both - button and append text absent");
// Inline
- inl = TestHelpers.datepicker.init('#inl');
- ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
- ok(inl.html() !== '', 'Inline - datepicker present');
- ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance present');
- 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(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), 'Inline - instance absent');
- ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
+ inl = TestHelpers.datepicker.init("#inl");
+ ok(inl.is(".hasDatepicker"), "Inline - marker class set");
+ ok(inl.html() !== "", "Inline - datepicker present");
+ ok($.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance present");
+ 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(!$.data(inl[0], TestHelpers.datepicker.PROP_NAME), "Inline - instance absent");
+ ok(inl.next().length === 0 || inl.next().is("p"), "Inline - button absent");
});
-test('enableDisable', function() {
+test("enableDisable", function() {
expect( 33 );
var inl, dp,
- inp = TestHelpers.datepicker.init('#inp');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
- inp.datepicker('disable');
- ok(inp.datepicker('isDisabled'), 'Enable/disable - now marked as disabled');
- ok(inp[0].disabled, 'Enable/disable - field now disabled');
- inp.datepicker('enable');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable - now marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable - field now enabled');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable - field now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable - field now enabled");
+ inp.datepicker("destroy");
// With a button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button'});
- ok(!inp.datepicker('isDisabled'), 'Enable/disable button - initially marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable button - field initially enabled');
- ok(!inp.next('button')[0].disabled, 'Enable/disable button - button initially enabled');
- inp.datepicker('disable');
- ok(inp.datepicker('isDisabled'), 'Enable/disable button - now marked as disabled');
- ok(inp[0].disabled, 'Enable/disable button - field now disabled');
- ok(inp.next('button')[0].disabled, 'Enable/disable button - button now disabled');
- inp.datepicker('enable');
- ok(!inp.datepicker('isDisabled'), 'Enable/disable button - now marked as enabled');
- ok(!inp[0].disabled, 'Enable/disable button - field now enabled');
- ok(!inp.next('button')[0].disabled, 'Enable/disable button - button now enabled');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button"});
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - initially marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field initially enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button initially enabled");
+ inp.datepicker("disable");
+ ok(inp.datepicker("isDisabled"), "Enable/disable button - now marked as disabled");
+ ok(inp[0].disabled, "Enable/disable button - field now disabled");
+ ok(inp.next("button")[0].disabled, "Enable/disable button - button now disabled");
+ inp.datepicker("enable");
+ ok(!inp.datepicker("isDisabled"), "Enable/disable button - now marked as enabled");
+ ok(!inp[0].disabled, "Enable/disable button - field now enabled");
+ ok(!inp.next("button")[0].disabled, "Enable/disable button - button now enabled");
+ inp.datepicker("destroy");
// With an image button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
- 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(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(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(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image now enabled');
- inp.datepicker('destroy');
+ inp = TestHelpers.datepicker.init("#inp", {showOn: "button", buttonImageOnly: true,
+ 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(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(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(parseFloat(inp.next("img").css("opacity")) === 1, "Enable/disable image - image now enabled");
+ inp.datepicker("destroy");
// Inline
- inl = TestHelpers.datepicker.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');
- inl.datepicker('disable');
- ok(inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as disabled');
- ok(dp.children().is('.ui-state-disabled'), 'Enable/disable inline - visually disabled');
- ok(dp.find('select').prop('disabled'), 'Enable/disable inline - form element disabled');
- inl.datepicker('enable');
- ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - now marked as enabled');
- ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visiually disabled');
- ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled');
- inl.datepicker('destroy');
+ inl = TestHelpers.datepicker.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");
+ inl.datepicker("disable");
+ ok(inl.datepicker("isDisabled"), "Enable/disable inline - now marked as disabled");
+ ok(dp.children().is(".ui-state-disabled"), "Enable/disable inline - visually disabled");
+ ok(dp.find("select").prop("disabled"), "Enable/disable inline - form element disabled");
+ inl.datepicker("enable");
+ ok(!inl.datepicker("isDisabled"), "Enable/disable inline - now marked as enabled");
+ ok(!dp.children().is(".ui-state-disabled"), "Enable/disable inline - not visiually disabled");
+ ok(!dp.find("select").prop("disabled"), "Enable/disable inline - form element enabled");
+ inl.datepicker("destroy");
});
})(jQuery);
View
1,428 tests/unit/datepicker/datepicker_options.js
@@ -6,113 +6,113 @@
module("datepicker: options");
-test('setDefaults', function() {