diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-06-21 16:16:59 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2008-06-21 16:16:59 +0000 |
commit | 2e3b8eac77fe95b583a945a022bced62c478408f (patch) | |
tree | 8c8ca400373c69649da85d17862feb29e2400c15 /tests/accordion.js | |
parent | 9196c2022c428d5aa2b75e2558f981458356e9da (diff) | |
download | jquery-ui-2e3b8eac77fe95b583a945a022bced62c478408f.tar.gz jquery-ui-2e3b8eac77fe95b583a945a022bced62c478408f.zip |
accordion: added test for headers with descendants; replaced while-loop to find header-parent with call to parents
Diffstat (limited to 'tests/accordion.js')
-rw-r--r-- | tests/accordion.js | 19 |
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); |