]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip: Fixed tooltipClass option and added test.
authorScott González <scott.gonzalez@gmail.com>
Sat, 28 May 2011 21:55:45 +0000 (17:55 -0400)
committerScott González <scott.gonzalez@gmail.com>
Sat, 28 May 2011 21:55:45 +0000 (17:55 -0400)
tests/unit/tooltip/tooltip_options.js
ui/jquery.ui.tooltip.js

index bbbab72ff926eeb4c33ebc8093811abceaaa3612..04bb4c6a4f8bce74c7530474cb1e6ab9b114bf0e 100644 (file)
@@ -2,25 +2,6 @@
 
 module( "tooltip: options" );
 
-test( "items", function() {
-       expect( 2 );
-       var element = $( "#qunit-fixture" ).tooltip({
-               items: "#fixture-span"
-       });
-
-       var event = $.Event( "mouseenter" );
-       event.target = $( "#fixture-span" )[ 0 ];
-       element.tooltip( "open", event );
-       same( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" );
-
-       // make sure default [title] doesn't get used
-       event.target = $( "#tooltipped1" )[ 0 ];
-       element.tooltip( "open", event );
-       same( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined );
-
-       element.tooltip( "destroy" );
-});
-
 test( "content: default", function() {
        var element = $( "#tooltipped1" ).tooltip().tooltip( "open" );
        same( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" );
@@ -62,4 +43,31 @@ asyncTest( "content: sync + async callback", function() {
        }).tooltip( "open" );
 });
 
+test( "items", function() {
+       expect( 2 );
+       var element = $( "#qunit-fixture" ).tooltip({
+               items: "#fixture-span"
+       });
+
+       var event = $.Event( "mouseenter" );
+       event.target = $( "#fixture-span" )[ 0 ];
+       element.tooltip( "open", event );
+       same( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" );
+
+       // make sure default [title] doesn't get used
+       event.target = $( "#tooltipped1" )[ 0 ];
+       element.tooltip( "open", event );
+       same( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined );
+
+       element.tooltip( "destroy" );
+});
+
+test( "tooltipClass", function() {
+       expect( 1 )
+       var element = $( "#tooltipped1" ).tooltip({
+               tooltipClass: "custom"
+       }).tooltip( "open" );
+       ok( $( "#" + element.attr( "aria-describedby" ) ).hasClass( "custom" ) );
+});
+
 }( jQuery ) );
index 343c1d055a065d691e9234f7f6a932c3b2612986..a6d3b1dd3ff2d994cc3fe65e9963ac25dd9db894 100644 (file)
@@ -142,7 +142,7 @@ $.widget( "ui.tooltip", {
                                id: id,
                                role: "tooltip"
                        })
-                       .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content" +
+                       .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
                                ( this.options.tooltipClass || "" ) );
                $( "<div>" )
                        .addClass( "ui-tooltip-content" )