aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/tooltip/tooltip_core.js20
-rw-r--r--ui/tooltip.js9
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/unit/tooltip/tooltip_core.js b/tests/unit/tooltip/tooltip_core.js
index 710444b44..760ffeed2 100644
--- a/tests/unit/tooltip/tooltip_core.js
+++ b/tests/unit/tooltip/tooltip_core.js
@@ -154,4 +154,24 @@ asyncTest( "programmatic focus with async content", function() {
element.focus();
});
+asyncTest( "destroy during hide animation; only one close event", function() {
+ expect( 1 );
+
+ var element = $( "#tooltipped1" ).tooltip({
+ show: false,
+ hide: true
+ });
+
+ element.bind( "tooltipclose", function() {
+ ok( true, "tooltip closed" );
+ });
+
+ element.tooltip( "open" );
+ element.tooltip( "close" );
+ setTimeout(function() {
+ element.tooltip( "destroy" );
+ start();
+ });
+});
+
}( jQuery ) );
diff --git a/ui/tooltip.js b/ui/tooltip.js
index 52be04dcb..048b6324a 100644
--- a/ui/tooltip.js
+++ b/ui/tooltip.js
@@ -296,6 +296,8 @@ return $.widget( "ui.tooltip", {
}, this.options.position ) );
}
+ this.hiding = false;
+ this.closing = false;
tooltip.hide();
this._show( tooltip, this.options.show );
@@ -362,9 +364,12 @@ return $.widget( "ui.tooltip", {
this._removeDescribedBy( target );
+ this.hiding = true;
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
that._removeTooltip( $( this ) );
+ this.hiding = false;
+ this.closing = false;
});
target.removeData( "ui-tooltip-open" );
@@ -385,7 +390,9 @@ return $.widget( "ui.tooltip", {
this.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );
- this.closing = false;
+ if ( !this.hiding ) {
+ this.closing = false;
+ }
},
_tooltip: function( element ) {