aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tooltip/tooltip_methods.js
blob: b1b319d9661ac367464e9e0d36f0be3f5d869cac (plain)
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
(function( $ ) {

module( "tooltip: methods" );

test( "destroy", function() {
	expect( 2 );
	domEqual( "#tooltipped1", function() {
		$( "#tooltipped1" ).tooltip().tooltip( "destroy" );
	});

	// make sure that open tooltips are removed on destroy
	$( "#tooltipped1" ).tooltip().tooltip( "open" ).tooltip( "destroy" );
	equal( $( ".ui-tooltip" ).length, 0 );
});

test( "open/close", function() {
	expect( 3 );
	$.fx.off = true;
	var element = $( "#tooltipped1" ).tooltip();
	equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );

	element.tooltip( "open" );
	var tooltip = $( "#" + element.attr( "aria-describedby" ) );
	ok( tooltip.is( ":visible" ) );

	element.tooltip( "close" );
	ok( tooltip.is( ":hidden" ) );
	$.fx.off = false;
});

/*
TODO currently tooltip doesn't override widget
can't return anything useful if no element is kept around and there's no useful reference
test("widget", function() {
	var tooltip = $("#tooltipped1").tooltip();
	same(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]);
	same(tooltip.tooltip("widget").end()[0], tooltip[0]);
});
*/

}( jQuery ) );