From eaefed517a960893204cade3525bda100454e13f Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 24 Jul 2013 20:10:16 -0700 Subject: fixes #8399 w/ tests --- js/tests/unit/tooltip.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'js/tests') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index ecb41c453..ed1bf54b3 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -181,6 +181,51 @@ $(function () { }, 100) }) + test("should wait 200 ms before hiding the tooltip", 3, function () { + var tooltip = $('') + .appendTo('#qunit-fixture') + .tooltip({ delay: { show: 0, hide: 200} }) + + stop() + + tooltip.trigger('mouseenter') + + setTimeout(function () { + ok($(".tooltip").is('.fade.in'), 'tooltip is faded in') + tooltip.trigger('mouseout') + setTimeout(function () { + ok($(".tooltip").is('.fade.in'), '100ms:tooltip is still faded in') + setTimeout(function () { + ok(!$(".tooltip").is('.in'), 'tooltip removed') + start() + }, 150) + }, 100) + }, 1) + }) + + test("should not hide tooltip if leave event occurs, then tooltip is show immediately again", function () { + var tooltip = $('') + .appendTo('#qunit-fixture') + .tooltip({ delay: { show: 0, hide: 200} }) + + stop() + + tooltip.trigger('mouseenter') + + setTimeout(function () { + ok($(".tooltip").is('.fade.in'), 'tooltip is faded in') + tooltip.trigger('mouseout') + setTimeout(function () { + ok($(".tooltip").is('.fade.in'), '100ms:tooltip is still faded in') + tooltip.trigger('mouseenter') + setTimeout(function () { + ok($(".tooltip").is('.in'), 'tooltip removed') + start() + }, 150) + }, 100) + }, 1) + }) + test("should not show tooltip if leave event occurs before delay expires", function () { var tooltip = $('') .appendTo('#qunit-fixture') -- cgit v1.2.3