Skip to content
Permalink
Browse files

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
  • Loading branch information
jzaefferer committed Mar 27, 2010
1 parent 11e719f commit d5a6b334669c8024573b8aa52014c83f3823f0c2
Showing with 36 additions and 46 deletions.
  1. +33 −31 tests/unit/accordion/accordion.html
  2. +3 −15 tests/unit/accordion/accordion_methods.js
@@ -38,37 +38,39 @@ <h2 id="qunit-userAgent"></h2>

<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">
@@ -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() {

0 comments on commit d5a6b33

Please sign in to comment.
You can’t perform that action at this time.