Accordion unit tets: Replacing destory method test with autocomplete/button approach, comparing before/after html - had to add some classes and empty style attributes to ignore class='' and style='', harmless enough

This commit is contained in:
jzaefferer 2010-03-27 08:01:41 +01:00
parent 11e719f8f8
commit d5a6b33466
2 changed files with 36 additions and 46 deletions

View File

@ -38,37 +38,39 @@
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
<div id="list1">
<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>
<div id="list1" class="foo">
<a class="bar">There is one obvious advantage:</a>
<div style="" class="foo">
<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 class="bar">Now that you've got...</a>
<div style="" class="foo">
<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 class="bar">Rent one bear, ...</a>
<div style="" class="foo">
<p>
get two for three beer.
</p>
<p>
And now, for something completely different.
</p>
</div>
</div>
</div>
<div id="navigationWrapper">

View File

@ -40,21 +40,9 @@ test("init", function() {
});
test("destroy", function() {
$("<div></div>").appendTo('body').accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on element');
$([]).accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on empty collection');
$('<div></div>').accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on disconnected DOMElement');
$('<div></div>').accordion().accordion("destroy").accordion("foo").remove();
ok(true, 'arbitrary method called after destroy');
var expected = $('<div></div>').accordion(),
actual = expected.accordion('destroy');
equals(actual, expected, 'destroy is chainable');
var beforeHtml = $("#list1").parent().html();
var afterHtml = $("#list1").accordion().accordion("destroy").parent().html();
equal( afterHtml, beforeHtml );
});
test("enable", function() {