Skip to content

Commit 61b4b3e

Browse files
committed
Tooltip: Unit tests cleanup
1 parent 732a485 commit 61b4b3e

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

tests/unit/tooltip/tooltip.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
1010
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
1111
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
12+
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
1213
<script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
1314

1415
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>

tests/unit/tooltip/tooltip_options.js

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

6-
module("tooltip: options");
7-
8-
function contentTest(name, expected, impl) {
9-
test(name, function() {
10-
$("#tooltipped1").tooltip({
11-
content: impl
12-
}).tooltip("open");
13-
same( $(".ui-tooltip").text(), expected );
6+
module("tooltip: options", {
7+
teardown: function() {
148
$(":ui-tooltip").tooltip("destroy");
15-
});
16-
}
9+
}
10+
});
11+
12+
test("content: default", function() {
13+
$("#tooltipped1").tooltip().tooltip("open");
14+
same( $(".ui-tooltip").text(), "anchortitle" );
15+
});
1716

18-
contentTest("content: default", "anchortitle");
19-
contentTest("content: return string", "customstring", function() {
20-
return "customstring";
17+
test("content: return string", function() {
18+
$("#tooltipped1").tooltip({
19+
content: function() {
20+
return "customstring";
21+
}
22+
}).tooltip("open");
23+
same( $(".ui-tooltip").text(), "customstring" );
2124
});
22-
contentTest("content: callback string", "customstring2", function(response) {
23-
response("customstring2");
25+
26+
test("content: callback string", function() {
27+
stop();
28+
$("#tooltipped1").tooltip({
29+
content: function(response) {
30+
response("customstring2");
31+
setTimeout(function() {
32+
same( $(".ui-tooltip").text(), "customstring2" );
33+
start();
34+
}, 100)
35+
}
36+
}).tooltip("open");
37+
2438
});
2539

2640
test("tooltipClass, default", function() {

0 commit comments

Comments
 (0)