Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJørgen Borgesen <joergen.borgesen@gmail.com>2012-05-20 21:59:53 +0400
committerJørgen Borgesen <joergen.borgesen@gmail.com>2012-05-20 21:59:53 +0400
commite388a5e475867cd266d58caf83b614aafe06cc10 (patch)
treed2b09e2f50c36a7b4661e962ab73daf7f086be5d /js
parente9a7d26d0636445fb20def22db54fe703164031b (diff)
Added unit test to check that tooltips is not showed when leave event is triggered before show delay has expired AND the hide delay is set to 0
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-tooltip.js1
-rw-r--r--js/tests/unit/bootstrap-tooltip.js21
2 files changed, 20 insertions, 2 deletions
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js
index 4c2a2a328d..6ff2b47086 100644
--- a/js/bootstrap-tooltip.js
+++ b/js/bootstrap-tooltip.js
@@ -87,7 +87,6 @@
if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide()
- clearTimeout(this.timeout)
self.hoverState = 'out'
this.timeout = setTimeout(function() {
if (self.hoverState == 'out') self.hide()
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js
index 63f4f0b07c..c25093420d 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/bootstrap-tooltip.js
@@ -78,6 +78,25 @@ $(function () {
}, 100)
})
+ test("should not show tooltip if leave event occurs before delay expires, even if hide delay is 0", function () {
+ var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
+ .appendTo('#qunit-fixture')
+ .tooltip({ delay: { show: 200, hide: 0} })
+
+ stop()
+
+ tooltip.trigger('mouseenter')
+
+ setTimeout(function () {
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
+ tooltip.trigger('mouseout')
+ setTimeout(function () {
+ ok(!$(".tooltip").is('.fade.in'), 'tooltip is not faded in')
+ start()
+ }, 200)
+ }, 100)
+ })
+
test("should not show tooltip if leave event occurs before delay expires", function () {
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
.appendTo('#qunit-fixture')
@@ -133,4 +152,4 @@ $(function () {
ok($.fn.tooltip.Constructor.prototype.isHTML($('<div></div>')), 'correctly detected html')
})
-}) \ No newline at end of file
+})