Skip to content

Commit d5a6b33

Browse files
committed
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
1 parent 11e719f commit d5a6b33

File tree

2 files changed

+36
-46
lines changed

2 files changed

+36
-46
lines changed

tests/unit/accordion/accordion.html

+33-31
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,39 @@ <h2 id="qunit-userAgent"></h2>
3838

3939
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
4040

41-
<div id="list1">
42-
<a>There is one obvious advantage:</a>
43-
<div>
44-
<p>
45-
You've seen it coming!
46-
<br/>
47-
Buy now and get nothing for free!
48-
<br/>
49-
Well, at least no free beer. Perhaps a bear, if you can afford it.
50-
</p>
51-
</div>
52-
<a>Now that you've got...</a>
53-
<div>
54-
<p>
55-
your bear, you have to admit it!
56-
<br/>
57-
No, we aren't selling bears.
58-
</p>
59-
<p>
60-
We could talk about renting one.
61-
</p>
62-
</div>
63-
<a>Rent one bear, ...</a>
64-
<div>
65-
<p>
66-
get two for three beer.
67-
</p>
68-
<p>
69-
And now, for something completely different.
70-
</p>
71-
</div>
41+
<div>
42+
<div id="list1" class="foo">
43+
<a class="bar">There is one obvious advantage:</a>
44+
<div style="" class="foo">
45+
<p>
46+
You've seen it coming!
47+
<br/>
48+
Buy now and get nothing for free!
49+
<br/>
50+
Well, at least no free beer. Perhaps a bear, if you can afford it.
51+
</p>
52+
</div>
53+
<a class="bar">Now that you've got...</a>
54+
<div style="" class="foo">
55+
<p>
56+
your bear, you have to admit it!
57+
<br/>
58+
No, we aren't selling bears.
59+
</p>
60+
<p>
61+
We could talk about renting one.
62+
</p>
63+
</div>
64+
<a class="bar">Rent one bear, ...</a>
65+
<div style="" class="foo">
66+
<p>
67+
get two for three beer.
68+
</p>
69+
<p>
70+
And now, for something completely different.
71+
</p>
72+
</div>
73+
</div>
7274
</div>
7375

7476
<div id="navigationWrapper">

tests/unit/accordion/accordion_methods.js

+3-15
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,9 @@ test("init", function() {
4040
});
4141

4242
test("destroy", function() {
43-
$("<div></div>").appendTo('body').accordion().accordion("destroy").remove();
44-
ok(true, '.accordion("destroy") called on element');
45-
46-
$([]).accordion().accordion("destroy").remove();
47-
ok(true, '.accordion("destroy") called on empty collection');
48-
49-
$('<div></div>').accordion().accordion("destroy").remove();
50-
ok(true, '.accordion("destroy") called on disconnected DOMElement');
51-
52-
$('<div></div>').accordion().accordion("destroy").accordion("foo").remove();
53-
ok(true, 'arbitrary method called after destroy');
54-
55-
var expected = $('<div></div>').accordion(),
56-
actual = expected.accordion('destroy');
57-
equals(actual, expected, 'destroy is chainable');
43+
var beforeHtml = $("#list1").parent().html();
44+
var afterHtml = $("#list1").accordion().accordion("destroy").parent().html();
45+
equal( afterHtml, beforeHtml );
5846
});
5947

6048
test("enable", function() {

0 commit comments

Comments
 (0)