aboutsummaryrefslogtreecommitdiffstats
path: root/tests/accordion.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/accordion.js')
-rw-r--r--tests/accordion.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/accordion.js b/tests/accordion.js
index 1fbd1e20c..e957acd43 100644
--- a/tests/accordion.js
+++ b/tests/accordion.js
@@ -10,10 +10,14 @@ jQuery.ui.accordion.defaults.animated = false;
function state(accordion) {
var args = $.makeArray(arguments).slice(1);
$.each(args, function(i, n) {
- equals(n, accordion.find("div").eq(i).is(":visible"));
+ equals(accordion.find("div").eq(i).is(":visible"), n);
});
}
+$.fn.triggerEvent = function(type, target) {
+ return this.triggerHandler(type, [jQuery.event.fix({ type: type, target: target })]);
+}
+
test("basics", function() {
state($('#list1').accordion(), 1, 0, 0);
});
@@ -82,4 +86,17 @@ test("activate, jQuery or DOM element", function() {
state(ac, 0, 1, 0);
});
+function state2(accordion) {
+ var args = $.makeArray(arguments).slice(1);
+ $.each(args, function(i, n) {
+ equals(accordion.find("ul").eq(i).is(":visible"), n);
+ });
+}
+
+test("handle click on header-descendant", function() {
+ var ac = $('#navigation').accordion({ header: '.head', autoHeight: false })
+ ac.triggerEvent("click", $('#navigation span:contains(Bass)')[0]);
+ state2(ac, 0, 1, 0);
+});
+
})(jQuery);