/[projects]/misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/tooltip/tooltip_methods.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/tooltip/tooltip_methods.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 2561 byte(s)
initial import
1 (function( $ ) {
2
3 module( "tooltip: methods" );
4
5 test( "destroy", function() {
6 expect( 3 );
7 var element = $( "#tooltipped1" );
8
9 domEqual( "#tooltipped1", function() {
10 element.tooltip().tooltip( "destroy" );
11 });
12
13 // make sure that open tooltips are removed on destroy
14 domEqual( "#tooltipped1", function() {
15 element
16 .tooltip()
17 .tooltip( "open", $.Event( "mouseover", { target: element[0] }) )
18 .tooltip( "destroy" );
19 });
20 equal( $( ".ui-tooltip" ).length, 0 );
21 });
22
23 test( "open/close", function() {
24 expect( 3 );
25 $.fx.off = true;
26 var tooltip,
27 element = $( "#tooltipped1" ).tooltip();
28 equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
29
30 element.tooltip( "open" );
31 tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
32 ok( tooltip.is( ":visible" ) );
33
34 element.tooltip( "close" );
35 ok( tooltip.is( ":hidden" ) );
36 $.fx.off = false;
37 });
38
39 // #8626 - Calling open() without an event
40 test( "open/close with tracking", function() {
41 expect( 3 );
42 $.fx.off = true;
43 var tooltip,
44 element = $( "#tooltipped1" ).tooltip({ track: true });
45 equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
46
47 element.tooltip( "open" );
48 tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
49 ok( tooltip.is( ":visible" ) );
50
51 element.tooltip( "close" );
52 ok( tooltip.is( ":hidden" ) );
53 $.fx.off = false;
54 });
55
56 test( "enable/disable", function() {
57 expect( 7 );
58 $.fx.off = true;
59 var tooltip,
60 element = $( "#tooltipped1" ).tooltip();
61 equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
62
63 element.tooltip( "open" );
64 tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
65 ok( tooltip.is( ":visible" ) );
66
67 element.tooltip( "disable" );
68 equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
69 // support: jQuery <1.6.2
70 // support: IE <8
71 // We should use strictEqual( ..., undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
72 ok( !tooltip.attr( "title" ), "title removed on disable" );
73
74 element.tooltip( "open" );
75 equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" );
76
77 element.tooltip( "enable" );
78 equal( element.attr( "title" ), "anchortitle", "title restored on enable" );
79
80 element.tooltip( "open" );
81 tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
82 ok( tooltip.is( ":visible" ) );
83 $.fx.off = false;
84 });
85
86 test( "widget", function() {
87 expect( 2 );
88 var element = $( "#tooltipped1" ).tooltip(),
89 widgetElement = element.tooltip( "widget" );
90 equal( widgetElement.length, 1, "one element" );
91 strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
92 });
93
94 }( jQuery ) );

  ViewVC Help
Powered by ViewVC 1.1.20