1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* tooltip_options.js
*/
(function($) {
module("tooltip: options", {
teardown: function() {
$(":ui-tooltip").tooltip("destroy");
}
});
test("option: items", function() {
var event = $.Event("mouseenter");
event.target = $("[data-tooltip]");
$("#qunit-fixture").tooltip({
items: "[data-tooltip]",
content: function() {
return $(this).attr("data-tooltip");
}
}).tooltip("open", event);
same( $(".ui-tooltip").text(), "text" );
});
test("content: default", function() {
$("#tooltipped1").tooltip().tooltip("open");
same( $(".ui-tooltip").text(), "anchortitle" );
});
test("content: return string", function() {
$("#tooltipped1").tooltip({
content: function() {
return "customstring";
}
}).tooltip("open");
same( $(".ui-tooltip").text(), "customstring" );
});
test("content: return jQuery", function() {
$("#tooltipped1").tooltip({
content: function() {
return $("<div></div>").html("cu<b>s</b>tomstring");
}
}).tooltip("open");
same( $(".ui-tooltip").text(), "customstring" );
});
test("content: callback string", function() {
stop();
$("#tooltipped1").tooltip({
content: function(response) {
response("customstring2");
setTimeout(function() {
same( $(".ui-tooltip").text(), "customstring2" );
start();
}, 100)
}
}).tooltip("open");
});
})(jQuery);
|