Skip to content

Commit 9651707

Browse files
committed
Panel: Switched to new tests format.
Panel: New visual tests. Panel: Options names changed (collapsed->expanded, collapseType->expandType, accordionGroupClass->accordionGroupName). Panel: New option 'resizable'. Panel: Added accordion functionality.
1 parent b0781f4 commit 9651707

File tree

10 files changed

+502
-412
lines changed

10 files changed

+502
-412
lines changed

tests/unit/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ <h2>Interactions</h2>
4242
<h2>Widgets</h2>
4343
<ul>
4444
<li><a href="accordion/accordion.html">Accordion</a></li>
45+
<li><a href="panel/panel.html">Panel</a></li>
4546
<li><a href="autocomplete/autocomplete.html">Autocomplete</a></li>
4647
<li><a href="button/button.html">Button</a></li>
4748
<li><a href="datepicker/datepicker.html">Datepicker</a></li>

tests/unit/panel/panel.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="UTF-8" />
4+
<meta charset="utf-8">
55
<title>jQuery UI Panel Test Suite</title>
66

7-
<link type="text/css" href="../../../themes/base/jquery.ui.panel.css" rel="stylesheet" />
7+
<link rel="stylesheet" href="../../../themes/base/jquery.ui.accordion.css">
88

9-
<script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
9+
<script src="../../../jquery-1.5.1.js"></script>
1010
<script type="text/javascript" src="../../../external/jquery.cookie.js"></script>
11-
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
12-
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
13-
<script type="text/javascript" src="../../../ui/jquery.ui.panel.js"></script>
11+
<script src="../../../ui/jquery.ui.core.js"></script>
12+
<script src="../../../ui/jquery.ui.widget.js"></script>
13+
<script src="../../../ui/jquery.ui.panel.js"></script>
1414

15-
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
16-
<script type="text/javascript" src="../../../external/qunit.js"></script>
17-
<script type="text/javascript" src="../../jquery.simulate.js"></script>
18-
<script type="text/javascript" src="../testsuite.js"></script>
15+
<link rel="stylesheet" href="../../../external/qunit.css">
16+
<script src="../../../external/qunit.js"></script>
17+
<script src="../../jquery.simulate.js"></script>
18+
<script src="../testsuite.js"></script>
1919

2020
<script type="text/javascript" src="panel_defaults.js"></script>
2121
<script type="text/javascript" src="panel_core.js"></script>
22-
<script type="text/javascript" src="panel_options.js"></script>
23-
<script type="text/javascript" src="panel_methods.js"></script>
2422
<script type="text/javascript" src="panel_events.js"></script>
23+
<script type="text/javascript" src="panel_methods.js"></script>
24+
<script type="text/javascript" src="panel_options.js"></script>
2525
<script type="text/javascript" src="panel_tickets.js"></script>
26-
26+
27+
<script src="../swarminject.js"></script>
2728
<style>
28-
#main { font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
29-
#list, #list1 *, #navigation, #navigation * { margin: 0; padding: 0; font-size: 12px; }
29+
#qunit-fixture { font-size: 10pt; font-family: "trebuchet ms", verdana, arial; }
3030
</style>
3131
</head>
3232
<body>
3333

3434
<h1 id="qunit-header">jQuery UI Panel Test Suite</h1>
3535
<h2 id="qunit-banner"></h2>
36+
<div id="qunit-testrunner-toolbar"></div>
3637
<h2 id="qunit-userAgent"></h2>
3738
<ol id="qunit-tests">
3839
</ol>
3940

40-
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
41+
<div id="qunit-fixture">
4142

42-
<div>
4343
<div id="panel1" class="foo">
4444
<h3 class="bar"><a >Header first</a></h3>
4545
<div class="foo">
@@ -48,7 +48,6 @@ <h3 class="bar"><a >Header first</a></h3>
4848
</p>
4949
</div>
5050
</div>
51-
</div>
5251

5352
</div>
5453

tests/unit/panel/panel_core.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
/*
2-
* panel_core.js
3-
*/
4-
5-
61
(function($) {
72

8-
module("panel: core");
9-
10-
test("accessibility", function () {
11-
expect(1);
12-
var ac = $('#panel1').panel();
13-
14-
equals( ac.attr("role"), "panel", "main role");
15-
});
3+
module("panel: core");
4+
5+
test("accessibility", function () {
6+
expect(1);
7+
var ac = $('#panel1').panel();
8+
9+
equals( ac.attr("role"), "panel", "main role");
10+
});
1611

17-
})(jQuery);
12+
})(jQuery);

tests/unit/panel/panel_defaults.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
/*
2-
* panel_defaults.js
3-
*/
4-
51
var panel_defaults = {
62
disabled: false,
73
event: "click",
84
collapsible: true,
9-
collapsed: false,
10-
collapseType: 'up',
11-
collapseSpeed: 'fast',
5+
expanded: true,
6+
expandType: 'down',
7+
expandSpeed: 'fast',
128
draggable: false,
9+
resizable: false,
1310
stackable: true,
1411
controls: false,
15-
accordionGroupClass: false,
12+
accordionGroupName: false,
1613
cookie: null,
1714
icons: {
1815
header : 'ui-icon-triangle-1-e',
@@ -25,4 +22,4 @@ var panel_defaults = {
2522

2623
};
2724

28-
commonWidgetTests('panel', { defaults: panel_defaults });
25+
commonWidgetTests('panel', { defaults: panel_defaults });

tests/unit/panel/panel_events.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
/*
2-
* panel_events.js
3-
*/
41
(function($) {
52

6-
module("panel: events");
7-
8-
test("open closed and close again", function() {
9-
expect(0);
10-
$("#panel1").panel({
11-
collapsible: true
3+
module("panel: events");
4+
5+
test("open closed and close again", function() {
6+
expect(0);
7+
$("#panel1").panel({
8+
collapsible: true
9+
});
1210
});
13-
});
1411

15-
})(jQuery);
12+
})(jQuery);

tests/unit/panel/panel_methods.js

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,45 @@
1-
/*
2-
* panel_methods.js
3-
*/
41
(function($) {
52

6-
module("panel: methods");
7-
8-
test("init", function() {
9-
$("<div></div>").appendTo('body').panel().remove();
10-
ok(true, '.panel() called on element');
11-
12-
$([]).panel().remove();
13-
ok(true, '.panel() called on empty collection');
14-
15-
$('<div></div>').panel().remove();
16-
ok(true, '.panel() called on disconnected DOMElement - never connected');
17-
18-
$('<div></div>').appendTo('body').remove().panel().remove();
19-
ok(true, '.panel() called on disconnected DOMElement - removed');
20-
21-
var el = $('<div></div>').panel();
22-
var foo = el.panel("option", "foo");
23-
el.remove();
24-
ok(true, 'arbitrary option getter after init');
25-
26-
$('<div></div>').panel().panel("option", "foo", "bar").remove();
27-
ok(true, 'arbitrary option setter after init');
28-
});
29-
30-
test("destroy", function() {
31-
var beforeHtml = $("#panel1").find("div").css("font-style", "normal").end().parent().html();
32-
var afterHtml = $("#panel1").panel().panel("destroy").parent().html();
33-
// Opera 9 outputs role="" instead of removing the attribute like everyone else
34-
if ($.browser.opera) {
35-
afterHtml = afterHtml.replace(/ role=""/g, "");
36-
}
37-
equal( afterHtml, beforeHtml );
38-
});
39-
40-
test("enable", function() {
41-
var expected = $('#panel1').panel(),
42-
actual = expected.panel('enable');
43-
equals(actual, expected, 'enable is chainable');
44-
});
45-
46-
test("disable", function() {
47-
var expected = $('#panel1').panel(),
48-
actual = expected.panel('disable');
49-
equals(actual, expected, 'disable is chainable');
50-
});
51-
52-
})(jQuery);
3+
module("panel: methods");
4+
5+
test("init", function() {
6+
$("<div></div>").appendTo('body').panel().remove();
7+
ok(true, '.panel() called on element');
8+
9+
$([]).panel().remove();
10+
ok(true, '.panel() called on empty collection');
11+
12+
$('<div></div>').panel().remove();
13+
ok(true, '.panel() called on disconnected DOMElement - never connected');
14+
15+
$('<div></div>').appendTo('body').remove().panel().remove();
16+
ok(true, '.panel() called on disconnected DOMElement - removed');
17+
18+
var el = $('<div></div>').panel();
19+
var foo = el.panel("option", "foo");
20+
el.remove();
21+
ok(true, 'arbitrary option getter after init');
22+
23+
$('<div></div>').panel().panel("option", "foo", "bar").remove();
24+
ok(true, 'arbitrary option setter after init');
25+
});
26+
27+
test( "destroy", function() {
28+
domEqual("#panel1", function() {
29+
$("#panel1").panel().panel("destroy");
30+
});
31+
});
32+
33+
test("enable", function() {
34+
var expected = $('#panel1').panel(),
35+
actual = expected.panel('enable');
36+
equals(actual, expected, 'enable is chainable');
37+
});
38+
39+
test("disable", function() {
40+
var expected = $('#panel1').panel(),
41+
actual = expected.panel('disable');
42+
equals(actual, expected, 'disable is chainable');
43+
});
44+
45+
})(jQuery);

0 commit comments

Comments
 (0)