Skip to content

Commit ad5bfc7

Browse files
committed
Accordion unit tests: Refactored state-helper function
1 parent 87ba795 commit ad5bfc7

File tree

4 files changed

+12
-30
lines changed

4 files changed

+12
-30
lines changed

tests/unit/accordion/accordion.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616
<script type="text/javascript" src="../../jquery.simulate.js"></script>
1717
<script type="text/javascript" src="../testsuite.js"></script>
1818

19+
<script type="text/javascript">
20+
$.ui.accordion.prototype.options.animated = false;
21+
22+
function state(accordion) {
23+
var args = $.makeArray(arguments).slice(1);
24+
var result = [];
25+
$.each(args, function(i, n) {
26+
result.push( accordion.find(".ui-accordion-content").eq(i).is(":visible") ? 1 : 0 );
27+
});
28+
same(args, result)
29+
}
30+
</script>
1931
<script type="text/javascript" src="accordion_core.js"></script>
2032
<script type="text/javascript" src="accordion_defaults.js"></script>
2133
<script type="text/javascript" src="accordion_events.js"></script>

tests/unit/accordion/accordion_core.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@
55

66
(function($) {
77

8-
$.ui.accordion.prototype.options.animated = false;
9-
10-
function state(accordion) {
11-
var args = $.makeArray(arguments).slice(1);
12-
var result = [];
13-
$.each(args, function(i, n) {
14-
result.push( accordion.find(".ui-accordion-content").eq(i).is(":visible") ? 1 : 0 );
15-
});
16-
same(args, result)
17-
}
18-
198
module("accordion: core");
209

2110
test("handle click on header-descendant", function() {

tests/unit/accordion/accordion_methods.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
*/
44
(function($) {
55

6-
function state(accordion) {
7-
var expected = $.makeArray(arguments).slice(1);
8-
var actual = [];
9-
$.each(expected, function(i, n) {
10-
actual.push( accordion.find(".ui-accordion-content").eq(i).is(":visible") ? 1 : 0 );
11-
});
12-
same(actual, expected)
13-
}
14-
156
module("accordion: methods");
167

178
test("init", function() {

tests/unit/accordion/accordion_options.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
*/
44
(function($) {
55

6-
function state(accordion) {
7-
var expected = $.makeArray(arguments).slice(1);
8-
var actual = [];
9-
$.each(expected, function(i, n) {
10-
actual.push( accordion.find(".ui-accordion-content").eq(i).is(":visible") ? 1 : 0 );
11-
});
12-
same(actual, expected)
13-
}
14-
15-
166
module("accordion: options");
177

188
test("{ active: first child }, default", function() {

0 commit comments

Comments
 (0)