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
|
(function( $ ) {
module( "tooltip: options" );
test( "items", function() {
var event = $.Event( "mouseenter" );
event.target = $( "[data-tooltip]" )[ 0 ];
var element = $( "#qunit-fixture" ).tooltip({
items: "[data-tooltip]",
content: function() {
return $( this ).attr( "data-tooltip" );
}
}).tooltip( "open", event );
same( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "text" );
element.tooltip( "destroy" );
});
test( "content: default", function() {
var element = $( "#tooltipped1" ).tooltip().tooltip("open");
same( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" );
});
test( "content: return string", function() {
var element = $( "#tooltipped1" ).tooltip({
content: function() {
return "customstring";
}
}).tooltip( "open" );
same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" );
});
test( "content: return jQuery", function() {
var element = $( "#tooltipped1" ).tooltip({
content: function() {
return $( "<div>" ).html( "cu<b>s</b>tomstring" );
}
}).tooltip( "open" );
same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" );
});
/*
TODO broken, probably related to async content
test("content: callback string", function() {
stop();
$("#tooltipped1").tooltip({
content: function(response) {
response("customstring2");
setTimeout(function() {
//console.log($("#tooltipped1").attr("aria-describedby"))
same( $( "#" + $("#tooltipped1").attr("aria-describedby") ).text(), "customstring2" );
start();
}, 100)
}
}).tooltip("open");
});
*/
}( jQuery ) );
|