From 417d5b29b4fbfcf95ef110b7bb307a20f2b34e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 11 Aug 2009 18:58:03 +0000 Subject: [PATCH] accordion: Fix for #4695 --- tests/unit/accordion/accordion.html | 2 ++ tests/unit/accordion/accordion_options.js | 12 ++++++++++-- .../accordion/accordion_option_fillSpace_true.html | 6 +++--- ui/ui.accordion.js | 7 +++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index c8d5aace8..cb4b67f32 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -56,6 +56,7 @@ + diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index b03eea223..29fc9c032 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -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() { diff --git a/tests/visual/accordion/accordion_option_fillSpace_true.html b/tests/visual/accordion/accordion_option_fillSpace_true.html index 06a06b4fb..477457adf 100644 --- a/tests/visual/accordion/accordion_option_fillSpace_true.html +++ b/tests/visual/accordion/accordion_option_fillSpace_true.html @@ -20,11 +20,11 @@

Accordion Header 1

-
+
Accordion Content 1

Accordion Header 2

-
+
Accordion Content 2

paragraph

paragraph

@@ -35,7 +35,7 @@

paragraph

Accordion Header 3

-
+
Accordion Content 3
  • list item
  • diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js index 911499baa..d3bbce8e4 100644 --- a/ui/ui.accordion.js +++ b/ui/ui.accordion.js @@ -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;