From ba752cf7eda841ded93688ab3167b5515fa1660c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Wed, 24 Oct 2012 10:00:39 -0400 Subject: [PATCH] Tooltip: Run _disable when disabled option is set on create. Fixes #8712 - Tooltip: Disabled tooltips on initialization. --- tests/unit/tooltip/tooltip_options.js | 8 ++++++++ ui/jquery.ui.tooltip.js | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 3be6518558f..9f0de2b5707 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -2,6 +2,14 @@ module( "tooltip: options" ); +test( "disabled: true", function() { + expect( 1 ); + $( "#tooltipped1" ).tooltip({ + disabled: true + }).tooltip( "open" ); + equal( $( ".ui-tooltip" ).length, 0 ); +}); + test( "content: default", function() { expect( 1 ); var element = $( "#tooltipped1" ).tooltip().tooltip( "open" ); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 43788a082e8..f93dd7a2f84 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -75,6 +75,10 @@ $.widget( "ui.tooltip", { this.tooltips = {}; // IDs of parent tooltips where we removed the title attribute this.parents = {}; + + if ( this.options.disabled ) { + this._disable(); + } }, _setOption: function( key, value ) {