diff options
Diffstat (limited to 'tests/unit/tooltip/tooltip_options.js')
-rw-r--r-- | tests/unit/tooltip/tooltip_options.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js new file mode 100644 index 000000000..6962d1e86 --- /dev/null +++ b/tests/unit/tooltip/tooltip_options.js @@ -0,0 +1,54 @@ +/* + * tooltip_options.js + */ +(function($) { + +module("tooltip: options", { + teardown: function() { + $(":ui-tooltip").tooltip("destroy"); + } +}); + + +test("option: items", function() { + ok(false, "missing items test"); +}); + +test("content: default", function() { + $("#tooltipped1").tooltip().tooltip("open"); + same( $(".ui-tooltip").text(), "anchortitle" ); +}); + +test("content: return string", function() { + $("#tooltipped1").tooltip({ + content: function() { + return "customstring"; + } + }).tooltip("open"); + same( $(".ui-tooltip").text(), "customstring" ); +}); + +test("content: return jQuery", function() { + $("#tooltipped1").tooltip({ + content: function() { + return $("<div></div>").html("cu<b>s</b>tomstring"); + } + }).tooltip("open"); + same( $(".ui-tooltip").text(), "customstring" ); +}); + +test("content: callback string", function() { + stop(); + $("#tooltipped1").tooltip({ + content: function(response) { + response("customstring2"); + setTimeout(function() { + same( $(".ui-tooltip").text(), "customstring2" ); + start(); + }, 100) + } + }).tooltip("open"); + +}); + +})(jQuery); |