Commit e388a5e4 authored by Jørgen Borgesen's avatar Jørgen Borgesen
Browse files

Added unit test to check that tooltips is not showed when leave event is...

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
parent e9a7d26d
5 merge requests!3655Updated unit test for tooltips. Now using is() instead of hasClass(),!3654Added fix for bootstrap-tooltip with show-delay but now hide delay.,!3551Swapped out .hasClass() with .is() when checking for multiple classes,!3550Clear tooltips delayed show timer when leave event is triggered. ALSO when hide delay is 0.,!3549Clear tooltips delayed show timer when leave event is triggered. ALSO when hide delay is 0.
Showing with 20 additions and 2 deletions
+20 -2
......@@ -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()
......
......@@ -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
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment