@@ -12,16 +12,18 @@ QUnit.module( "tooltip: options", beforeAfterEach() );
12
12
13
13
QUnit . test ( "disabled: true" , function ( assert ) {
14
14
assert . expect ( 1 ) ;
15
- $ ( "#tooltipped1" ) . tooltip ( {
15
+ var element = $ ( "#tooltipped1" ) . tooltip ( {
16
16
disabled : true
17
17
} ) . tooltip ( "open" ) ;
18
18
assert . equal ( $ ( ".ui-tooltip" ) . length , 0 ) ;
19
+ element . tooltip ( "destroy" ) ;
19
20
} ) ;
20
21
21
22
QUnit . test ( "content: default" , function ( assert ) {
22
23
assert . expect ( 1 ) ;
23
24
var element = $ ( "#tooltipped1" ) . tooltip ( ) . tooltip ( "open" ) ;
24
25
assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "anchortitle" ) ;
26
+ element . tooltip ( "destroy" ) ;
25
27
} ) ;
26
28
27
29
QUnit . test ( "content: default; HTML escaping" , function ( assert ) {
@@ -36,6 +38,7 @@ QUnit.test( "content: default; HTML escaping", function( assert ) {
36
38
assert . equal ( $ . ui . tooltip . hacked , false , "script did not execute" ) ;
37
39
assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , scriptText ,
38
40
"correct tooltip text" ) ;
41
+ element . tooltip ( "destroy" ) ;
39
42
} ) ;
40
43
41
44
QUnit . test ( "content: return string" , function ( assert ) {
@@ -46,6 +49,7 @@ QUnit.test( "content: return string", function( assert ) {
46
49
}
47
50
} ) . tooltip ( "open" ) ;
48
51
assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring" ) ;
52
+ element . tooltip ( "destroy" ) ;
49
53
} ) ;
50
54
51
55
QUnit . test ( "content: return jQuery" , function ( assert ) {
@@ -59,6 +63,7 @@ QUnit.test( "content: return jQuery", function( assert ) {
59
63
assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring" ) ;
60
64
assert . equal ( liveRegion . children ( ) . last ( ) . html ( ) . toLowerCase ( ) , "<div>cu<b>s</b>tomstring</div>" ,
61
65
"The accessibility live region will strip the ids but keep the structure" ) ;
66
+ element . tooltip ( "destroy" ) ;
62
67
} ) ;
63
68
64
69
QUnit . test ( "content: sync + async callback" , function ( assert ) {
@@ -72,6 +77,8 @@ QUnit.test( "content: sync + async callback", function( assert ) {
72
77
response ( "customstring2" ) ;
73
78
setTimeout ( function ( ) {
74
79
assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring2" ) ;
80
+
81
+ element . tooltip ( "destroy" ) ;
75
82
ready ( ) ;
76
83
} , 13 ) ;
77
84
} , 13 ) ;
@@ -94,6 +101,8 @@ QUnit.test( "content: async callback loses focus before load", function( assert
94
101
setTimeout ( function ( ) {
95
102
assert . ok ( ! $ ( "#" + element . data ( "ui-tooltip-id" ) ) . is ( ":visible" ) ,
96
103
"Tooltip should not display" ) ;
104
+
105
+ element . tooltip ( "destroy" ) ;
97
106
ready ( ) ;
98
107
} ) ;
99
108
} ) ;
@@ -117,6 +126,8 @@ QUnit.test( "content: change while open", function( assert ) {
117
126
return "new" ;
118
127
} ) ;
119
128
assert . equal ( ui . tooltip . text ( ) , "new" , "updated content" ) ;
129
+
130
+ element . tooltip ( "destroy" ) ;
120
131
} ) ;
121
132
122
133
element . tooltip ( "open" ) ;
@@ -129,7 +140,7 @@ QUnit.test( "content: string", function( assert ) {
129
140
open : function ( event , ui ) {
130
141
assert . equal ( ui . tooltip . text ( ) , "just a string" ) ;
131
142
}
132
- } ) . tooltip ( "open" ) ;
143
+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
133
144
} ) ;
134
145
135
146
QUnit . test ( "content: element" , function ( assert ) {
@@ -141,7 +152,7 @@ QUnit.test( "content: element", function( assert ) {
141
152
open : function ( event , ui ) {
142
153
assert . equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
143
154
}
144
- } ) . tooltip ( "open" ) ;
155
+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
145
156
} ) ;
146
157
147
158
QUnit . test ( "content: jQuery" , function ( assert ) {
@@ -153,7 +164,7 @@ QUnit.test( "content: jQuery", function( assert ) {
153
164
open : function ( event , ui ) {
154
165
assert . equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
155
166
}
156
- } ) . tooltip ( "open" ) ;
167
+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
157
168
} ) ;
158
169
159
170
QUnit . test ( "items" , function ( assert ) {
@@ -217,14 +228,17 @@ QUnit.test( "track + show delay", function( assert ) {
217
228
topVal + offsetVal , 0.5 ,
218
229
"top position"
219
230
) ;
231
+
232
+ element . tooltip ( "destroy" ) ;
220
233
} ) ;
221
234
222
235
QUnit . test ( "track and programmatic focus" , function ( assert ) {
223
236
assert . expect ( 1 ) ;
224
- $ ( "#qunit-fixture div input" ) . tooltip ( {
237
+ var element = $ ( "#qunit-fixture div input" ) . tooltip ( {
225
238
track : true
226
239
} ) . trigger ( "focus" ) ;
227
240
assert . equal ( "inputtitle" , $ ( ".ui-tooltip" ) . text ( ) ) ;
241
+ element . tooltip ( "destroy" ) ;
228
242
} ) ;
229
243
230
244
} ) ;
0 commit comments