aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2009-01-30 03:27:44 +0000
committerScott González <scott.gonzalez@gmail.com>2009-01-30 03:27:44 +0000
commit967d6595a6387e74f3fb2f87233d0f82e2f4d8c7 (patch)
treeb474e08d2887a7ff90ce6e2830ef0947ae2de8d6
parent902c1910e7d7094d92bc6d96c05f6ffc471a7cd8 (diff)
downloadjquery-ui-967d6595a6387e74f3fb2f87233d0f82e2f4d8c7.tar.gz
jquery-ui-967d6595a6387e74f3fb2f87233d0f82e2f4d8c7.zip
Accordion: Fixed destroy method with new markup.
-rw-r--r--tests/unit/accordion/accordion.html72
-rw-r--r--tests/unit/accordion/accordion.js30
-rw-r--r--ui/ui.accordion.js4
3 files changed, 49 insertions, 57 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html
index 3900c072c..5e5012dbc 100644
--- a/tests/unit/accordion/accordion.html
+++ b/tests/unit/accordion/accordion.html
@@ -19,47 +19,41 @@
<div id="main">
<div id="list1">
- <div>
- <a>There is one obvious advantage:</a>
- <div>
- <p>
- You've seen it coming!
- <br/>
- Buy now and get nothing for free!
- <br/>
- Well, at least no free beer. Perhaps a bear, if you can afford it.
- </p>
- </div>
- </div>
- <div>
- <a>Now that you've got...</a>
- <div>
- <p>
- your bear, you have to admit it!
- <br/>
- No, we aren't selling bears.
- </p>
- <p>
- We could talk about renting one.
- </p>
- </div>
- </div>
- <div>
- <a>Rent one bear, ...</a>
- <div>
- <p>
- get two for three beer.
- </p>
- <p>
- And now, for something completely different.
- </p>
- </div>
- </div>
+ <a>There is one obvious advantage:</a>
+ <div>
+ <p>
+ You've seen it coming!
+ <br/>
+ Buy now and get nothing for free!
+ <br/>
+ Well, at least no free beer. Perhaps a bear, if you can afford it.
+ </p>
+ </div>
+ <a>Now that you've got...</a>
+ <div>
+ <p>
+ your bear, you have to admit it!
+ <br/>
+ No, we aren't selling bears.
+ </p>
+ <p>
+ We could talk about renting one.
+ </p>
+ </div>
+ <a>Rent one bear, ...</a>
+ <div>
+ <p>
+ get two for three beer.
+ </p>
+ <p>
+ And now, for something completely different.
+ </p>
+ </div>
</div>
<ul id="navigation">
+ <li><a href="?p=1.1.1">Guitar</a></li>
<li>
- <a href="?p=1.1.1">Guitar</a>
<ul>
<li><a href="?p=1.1.1.1">Electric</a></li>
<li><a href="?p=1.1.1.2">Acoustic</a></li>
@@ -68,8 +62,8 @@
<li><a href="?p=1.1.1.5">Accessories</a></li>
</ul>
</li>
+ <li><a href="?p=1.1.2"><span>Bass</span></a></li>
<li>
- <a href="?p=1.1.2"><span>Bass</span></a>
<ul>
<li><a href="?p=1.1.2.1">Electric</a></li>
<li><a href="?p=1.1.2.2">Acoustic</a></li>
@@ -80,8 +74,8 @@
<li><a href="?p=1.1.2.5">Accessories</a></li>
</ul>
</li>
+ <li><a href="?p=1.1.3">Drums</a></li>
<li>
- <a href="?p=1.1.3">Drums</a>
<ul>
<li><a href="?p=1.1.3.2">Acoustic Drums</a></li>
<li><a href="?p=1.1.3.3">Electronic Drums</a></li>
diff --git a/tests/unit/accordion/accordion.js b/tests/unit/accordion/accordion.js
index 44f89100d..63222465e 100644
--- a/tests/unit/accordion/accordion.js
+++ b/tests/unit/accordion/accordion.js
@@ -24,13 +24,13 @@ test("basics", function() {
test("autoHeight", function() {
$('#navigation').accordion({ autoHeight: false });
- equals( 90, $('#navigation div:first').height() );
- equals( 126, $('#navigation div:eq(1)').height() );
- equals( 54, $('#navigation div:last').height() );
+ equals( $('#navigation > li:eq(1)').height(), 90 );
+ equals( $('#navigation > li:eq(3)').height(), 126 );
+ equals( $('#navigation > li:eq(5)').height(), 54 );
$('#navigation').accordion("destroy").accordion({ autoHeight: true });
- equals( 126, $('#navigation div:first').height() );
- equals( 126, $('#navigation div:eq(1)').height() );
- equals( 126, $('#navigation div:last').height() );
+ equals( $('#navigation > li:eq(1)').height(), 126 );
+ equals( $('#navigation > li:eq(3)').height(), 126 );
+ equals( $('#navigation > li:eq(5)').height(), 126 );
});
test("activate, numeric", function() {
@@ -94,7 +94,7 @@ function state2(accordion) {
}
test("handle click on header-descendant", function() {
- var ac = $('#navigation').accordion({ autoHeight: false })
+ var ac = $('#navigation').accordion({ autoHeight: false });
ac.triggerEvent("click", $('#navigation span:contains(Bass)')[0]);
state2(ac, 0, 1, 0);
});
@@ -114,17 +114,17 @@ test("accordionchange event, open closed and close again", function() {
alwaysOpen: false
})
.one("accordionchange", function(event, ui) {
- equals( ui.oldHeader.size(), 0 )
- equals( ui.oldContent.size(), 0 )
- equals( ui.newHeader.size(), 1 )
- equals( ui.newContent.size(), 1 )
+ equals( ui.oldHeader.size(), 0 );
+ equals( ui.oldContent.size(), 0 );
+ equals( ui.newHeader.size(), 1 );
+ equals( ui.newContent.size(), 1 );
})
.accordion("activate", 0)
.one("accordionchange", function(event, ui) {
- equals( ui.oldHeader.size(), 1 )
- equals( ui.oldContent.size(), 1 )
- equals( ui.newHeader.size(), 0 )
- equals( ui.newContent.size(), 0 )
+ equals( ui.oldHeader.size(), 1 );
+ equals( ui.oldContent.size(), 1 );
+ equals( ui.newHeader.size(), 0 );
+ equals( ui.newContent.size(), 0 );
})
.accordion("activate", 0);
});
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js
index 4fa0869f3..59ae6910a 100644
--- a/ui/ui.accordion.js
+++ b/ui/ui.accordion.js
@@ -105,9 +105,7 @@ $.widget("ui.accordion", {
this.headers.find("a").removeAttr("tabindex");
this.headers.children(".ui-icon").remove();
- this.headers.next().removeClass("ui-accordion-content ui-accordion-content-active").each(function() {
- $(this).parent().replaceWith(this);
- });
+ this.headers.next().removeClass("ui-accordion-content ui-accordion-content-active");
},