@@ -12,16 +12,18 @@ QUnit.module( "tooltip: options", beforeAfterEach() );
1212
1313QUnit . test ( "disabled: true" , function ( assert ) {
1414 assert . expect ( 1 ) ;
15- $ ( "#tooltipped1" ) . tooltip ( {
15+ var element = $ ( "#tooltipped1" ) . tooltip ( {
1616 disabled : true
1717 } ) . tooltip ( "open" ) ;
1818 assert . equal ( $ ( ".ui-tooltip" ) . length , 0 ) ;
19+ element . tooltip ( "destroy" ) ;
1920} ) ;
2021
2122QUnit . test ( "content: default" , function ( assert ) {
2223 assert . expect ( 1 ) ;
2324 var element = $ ( "#tooltipped1" ) . tooltip ( ) . tooltip ( "open" ) ;
2425 assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "anchortitle" ) ;
26+ element . tooltip ( "destroy" ) ;
2527} ) ;
2628
2729QUnit . test ( "content: default; HTML escaping" , function ( assert ) {
@@ -36,6 +38,7 @@ QUnit.test( "content: default; HTML escaping", function( assert ) {
3638 assert . equal ( $ . ui . tooltip . hacked , false , "script did not execute" ) ;
3739 assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , scriptText ,
3840 "correct tooltip text" ) ;
41+ element . tooltip ( "destroy" ) ;
3942} ) ;
4043
4144QUnit . test ( "content: return string" , function ( assert ) {
@@ -46,6 +49,7 @@ QUnit.test( "content: return string", function( assert ) {
4649 }
4750 } ) . tooltip ( "open" ) ;
4851 assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring" ) ;
52+ element . tooltip ( "destroy" ) ;
4953} ) ;
5054
5155QUnit . test ( "content: return jQuery" , function ( assert ) {
@@ -59,6 +63,7 @@ QUnit.test( "content: return jQuery", function( assert ) {
5963 assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring" ) ;
6064 assert . equal ( liveRegion . children ( ) . last ( ) . html ( ) . toLowerCase ( ) , "<div>cu<b>s</b>tomstring</div>" ,
6165 "The accessibility live region will strip the ids but keep the structure" ) ;
66+ element . tooltip ( "destroy" ) ;
6267} ) ;
6368
6469QUnit . test ( "content: sync + async callback" , function ( assert ) {
@@ -72,6 +77,8 @@ QUnit.test( "content: sync + async callback", function( assert ) {
7277 response ( "customstring2" ) ;
7378 setTimeout ( function ( ) {
7479 assert . deepEqual ( $ ( "#" + element . data ( "ui-tooltip-id" ) ) . text ( ) , "customstring2" ) ;
80+
81+ element . tooltip ( "destroy" ) ;
7582 ready ( ) ;
7683 } , 13 ) ;
7784 } , 13 ) ;
@@ -94,6 +101,8 @@ QUnit.test( "content: async callback loses focus before load", function( assert
94101 setTimeout ( function ( ) {
95102 assert . ok ( ! $ ( "#" + element . data ( "ui-tooltip-id" ) ) . is ( ":visible" ) ,
96103 "Tooltip should not display" ) ;
104+
105+ element . tooltip ( "destroy" ) ;
97106 ready ( ) ;
98107 } ) ;
99108 } ) ;
@@ -117,6 +126,8 @@ QUnit.test( "content: change while open", function( assert ) {
117126 return "new" ;
118127 } ) ;
119128 assert . equal ( ui . tooltip . text ( ) , "new" , "updated content" ) ;
129+
130+ element . tooltip ( "destroy" ) ;
120131 } ) ;
121132
122133 element . tooltip ( "open" ) ;
@@ -129,7 +140,7 @@ QUnit.test( "content: string", function( assert ) {
129140 open : function ( event , ui ) {
130141 assert . equal ( ui . tooltip . text ( ) , "just a string" ) ;
131142 }
132- } ) . tooltip ( "open" ) ;
143+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
133144} ) ;
134145
135146QUnit . test ( "content: element" , function ( assert ) {
@@ -141,7 +152,7 @@ QUnit.test( "content: element", function( assert ) {
141152 open : function ( event , ui ) {
142153 assert . equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
143154 }
144- } ) . tooltip ( "open" ) ;
155+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
145156} ) ;
146157
147158QUnit . test ( "content: jQuery" , function ( assert ) {
@@ -153,7 +164,7 @@ QUnit.test( "content: jQuery", function( assert ) {
153164 open : function ( event , ui ) {
154165 assert . equal ( ui . tooltip . children ( ) . html ( ) . toLowerCase ( ) , content ) ;
155166 }
156- } ) . tooltip ( "open" ) ;
167+ } ) . tooltip ( "open" ) . tooltip ( "destroy" ) ;
157168} ) ;
158169
159170QUnit . test ( "items" , function ( assert ) {
@@ -217,14 +228,17 @@ QUnit.test( "track + show delay", function( assert ) {
217228 topVal + offsetVal , 0.5 ,
218229 "top position"
219230 ) ;
231+
232+ element . tooltip ( "destroy" ) ;
220233} ) ;
221234
222235QUnit . test ( "track and programmatic focus" , function ( assert ) {
223236 assert . expect ( 1 ) ;
224- $ ( "#qunit-fixture div input" ) . tooltip ( {
237+ var element = $ ( "#qunit-fixture div input" ) . tooltip ( {
225238 track : true
226239 } ) . trigger ( "focus" ) ;
227240 assert . equal ( "inputtitle" , $ ( ".ui-tooltip" ) . text ( ) ) ;
241+ element . tooltip ( "destroy" ) ;
228242} ) ;
229243
230244} ) ;
0 commit comments