From 9740d8bb697dadf7dba1c271cce87d0d90c7ac62 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 3 Sep 2014 13:11:40 +0100 Subject: Fix tooltip occasionally not hiding when using a hide delay Fixes #14375. Closes #14519 by merging it. --- js/tests/unit/tooltip.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'js/tests/unit/tooltip.js') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 351dd61cb5..01c90a81cf 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -928,6 +928,36 @@ $(function () { $tooltip.trigger('mouseenter') }) + test('should hide tip after hide delay even if moused left before end of fade in', function () { + stop() + + var $tooltip = $('') + .appendTo('#qunit-fixture') + .bootstrapTooltip({ delay: { show: 10, hide: 10 }}) + + setTimeout(function () { + ok(!$tooltip.data('bs.tooltip').$tip, '1ms: tooltip exists') + + setTimeout(function () { + ok($tooltip.data('bs.tooltip').$tip.is('.fade.in'), '10ms: tooltip faded in') + }, 10) + + setTimeout(function () { + ok($tooltip.data('bs.tooltip').$tip.is('.fade.in'), '15ms: tooltip faded in') + + $tooltip.trigger('mouseout') + }, 15) + + setTimeout(function () { + ok(!$tooltip.data('bs.tooltip').$tip.is('.fade.in'), '30ms: tooltip faded out') + + start() + }, 30) + }, 0) + + $tooltip.trigger('mouseenter') + }) + test('should correctly position tooltips on SVG elements', function () { if (!window.SVGElement) { // Skip IE8 since it doesn't support SVG -- cgit v1.2.3