|
3 | 3 | */
|
4 | 4 | (function($) {
|
5 | 5 |
|
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() { |
14 | 8 | $(":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 | +}); |
17 | 16 |
|
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" ); |
21 | 24 | });
|
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 | + |
24 | 38 | });
|
25 | 39 |
|
26 | 40 | test("tooltipClass, default", function() {
|
|
0 commit comments