});
same(args, result)
}
+ function equalHeights(accordion, min, max) {
+ var sizes = [];
+ accordion.find(".ui-accordion-content").each(function() {
+ sizes.push($(this).outerHeight());
+ });
+ ok( sizes[0] >= min && sizes[0] <= max, "must be within " + min + " and " + max + ", was " + sizes[0] );
+ same(sizes[0], sizes[1]);
+ same(sizes[0], sizes[2]);
+ }
</script>
<script type="text/javascript" src="accordion_core.js"></script>
<script type="text/javascript" src="accordion_defaults.js"></script>
<style>
#main { font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
- #list, #list1 *, #navigation, #navigation * { margin: 0; padding: 0; font-size: 12px; list-style: none; border: 0; outline: 0; }
+ #list, #list1 *, #navigation, #navigation * { margin: 0; padding: 0; font-size: 12px; }
</style>
</head>
<body>
test("destroy", function() {
var beforeHtml = $("#list1").find("div").css("font-style", "normal").end().parent().html();
var afterHtml = $("#list1").accordion().accordion("destroy").parent().html();
+ // Opera 9 outputs role="" instead of removing the attribute like everyone else
+ if ($.browser.opera) {
+ afterHtml = afterHtml.replace(/ role=""/g, "");
+ }
equal( afterHtml, beforeHtml );
});
var expected = $('#navigation').parent().height(300).end().accordion({
fillSpace: true
});
-
- var sizes = [];
- expected.find(".ui-accordion-content").each(function() {
- sizes.push($(this).outerHeight());
- });
- same(sizes, [246, 246, 246]);
+ equalHeights(expected, 246, 258);
expected.parent().height(500);
expected.accordion("resize");
- var sizes2 = [];
- expected.find(".ui-accordion-content").each(function() {
- sizes2.push($(this).outerHeight());
- });
- same(sizes2, [446, 446, 446]);
+ equalHeights(expected, 446, 458);
});
})(jQuery);
});
test("{ autoHeight: true }, default", function() {
- $('#navigation').accordion({ autoHeight: true });
- equals( $('#navigation > li:eq(0) > ul').height(), 126 );
- equals( $('#navigation > li:eq(1) > ul').height(), 126 );
- equals( $('#navigation > li:eq(2) > ul').height(), 126 );
+ equalHeights($('#navigation').accordion({ autoHeight: true }), 95, 130);
});
test("{ autoHeight: false }", function() {
- $('#navigation').accordion({ autoHeight: false });
- equals( $('#navigation > li:eq(0) > ul').height(), 90 );
- equals( $('#navigation > li:eq(1) > ul').height(), 126 );
- equals( $('#navigation > li:eq(2) > ul').height(), 54 );
+ var accordion = $('#navigation').accordion({ autoHeight: false });
+ var sizes = [];
+ accordion.find(".ui-accordion-content").each(function() {
+ sizes.push($(this).outerHeight());
+ });
+ ok( sizes[0] >= 70 && sizes[0] <= 90 );
+ ok( sizes[1] >= 98 && sizes[1] <= 126 );
+ ok( sizes[2] >= 54 && sizes[2] <= 54 );
});
test("{ collapsible: false }, default", function() {
state(ac, 0, 0, 0);
});
-test("{ fillSpace: false }, default", function() {
- $("#navigationWrapper").height(500);
- $('#navigation').accordion({ fillSpace: false });
- equals( $('#navigation > li:eq(0) > ul').height(), 126 );
- equals( $('#navigation > li:eq(1) > ul').height(), 126 );
- equals( $('#navigation > li:eq(2) > ul').height(), 126 );
-});
-
+// fillSpace: false == autoHeight: true, covered above
test("{ fillSpace: true }", function() {
$("#navigationWrapper").height(500);
- $('#navigation').accordion({ fillSpace: true });
- equals( $('#navigation > li:eq(0) > ul').height(), 446 );
- equals( $('#navigation > li:eq(1) > ul').height(), 446 );
- equals( $('#navigation > li:eq(2) > ul').height(), 446 );
+ equalHeights($('#navigation').accordion({ fillSpace: true }), 446, 458);
});
test("{ header: '> li > :first-child,> :not(li):even' }, default", function() {