Skip to content
Permalink
Browse files

Tooltip: Allow strings for content option.

  • Loading branch information
scottgonzalez committed Aug 31, 2012
1 parent dee7c8b commit e242868f563fa244c6cbe04a421cb1734a322024
Showing with 16 additions and 1 deletion.
  1. +10 −0 tests/unit/tooltip/tooltip_options.js
  2. +6 −1 ui/jquery.ui.tooltip.js
@@ -65,6 +65,16 @@ test( "content: change while open", function() {
element.tooltip( "open" );
});

test( "content: string", function() {
expect( 1 );
var element = $( "#tooltipped1" ).tooltip({
content: "just a string",
open: function( event, ui ) {
equal( ui.tooltip.text(), "just a string" );
}
}).tooltip( "open" );
});

test( "items", function() {
expect( 2 );
var event,
@@ -152,9 +152,14 @@ $.widget( "ui.tooltip", {

_updateContent: function( target, event ) {
var content,
contentOption = this.options.content,
that = this;

content = this.options.content.call( target[0], function( response ) {
if ( typeof contentOption === "string" ) {
return this._open( event, target, contentOption );
}

content = contentOption.call( target[0], function( response ) {
// ignore async response if tooltip was closed already
if ( !target.data( "tooltip-open" ) ) {
return;

0 comments on commit e242868

Please sign in to comment.
You can’t perform that action at this time.