Skip to content

Commit

Permalink
accordion: Fix for #4695
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Aug 11, 2009
1 parent e132c1b commit 417d5b2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions tests/unit/accordion/accordion.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
</div>
</div>

<div id="navigationWrapper">
<ul id="navigation">
<li>
<h2><a href="?p=1.1.1">Guitar</a></h2>
Expand Down Expand Up @@ -88,6 +89,7 @@ <h2><a href="?p=1.1.3">Drums</a></h2>
</ul>
</li>
</ul>
</div>

</div>

Expand Down
12 changes: 10 additions & 2 deletions tests/unit/accordion/accordion_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,19 @@ test("{ event: 'mouseover' }", function() {
});

test("{ fillSpace: false }, default", function() {
ok(false, 'missing test - untested code is broken code');
$("#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 );
});

test("{ fillSpace: true }", function() {
ok(false, 'missing test - untested code is broken code');
$("#navigationWrapper").height(500);
$('#navigation').accordion({ fillSpace: true });
equals( $('#navigation > li:eq(0) > ul').height(), 386 );
equals( $('#navigation > li:eq(1) > ul').height(), 386 );
equals( $('#navigation > li:eq(2) > ul').height(), 386 );
});

test("{ header: '> li > :first-child,> :not(li):even' }, default", function() {
Expand Down
6 changes: 3 additions & 3 deletions tests/visual/accordion/accordion_option_fillSpace_true.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<div style="height: 500px; width: 500px; border: 1px solid red;">
<div id="accordion" style="width:490px;">
<h3><a href="#">Accordion Header 1</a></h3>
<div>
<div style="padding-top: 1em">
Accordion Content 1
</div>
<h3><a href="#">Accordion Header 2</a></h3>
<div>
<div style="padding-top: 3em">
Accordion Content 2
<p>paragraph</p>
<p>paragraph</p>
Expand All @@ -35,7 +35,7 @@ <h3><a href="#">Accordion Header 2</a></h3>
<p>paragraph</p>
</div>
<h3><a href="#">Accordion Header 3</a></h3>
<div>
<div style="padding-top: 0">
Accordion Content 3
<ul>
<li>list item</li>
Expand Down
7 changes: 3 additions & 4 deletions ui/ui.accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,10 @@ $.widget("ui.accordion", {
maxHeight -= $(this).outerHeight(true);
});

var maxPadding = 0;
this.headers.next().each(function() {
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
}).height(Math.max(0, maxHeight - maxPadding))
.css('overflow', 'auto');
var padding = $(this).innerHeight() - $(this).height();
$(this).height(Math.max(0, maxHeight - padding));
}).css('overflow', 'auto');

} else if ( o.autoHeight ) {
maxHeight = 0;
Expand Down

0 comments on commit 417d5b2

Please sign in to comment.