mirror of
https://github.com/twbs/bootstrap.git
synced 2025-03-02 02:29:24 +01:00
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
This commit is contained in:
parent
e9a7d26d06
commit
e388a5e475
1
js/bootstrap-tooltip.js
vendored
1
js/bootstrap-tooltip.js
vendored
@ -87,7 +87,6 @@
|
|||||||
if (this.timeout) clearTimeout(this.timeout)
|
if (this.timeout) clearTimeout(this.timeout)
|
||||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||||
|
|
||||||
clearTimeout(this.timeout)
|
|
||||||
self.hoverState = 'out'
|
self.hoverState = 'out'
|
||||||
this.timeout = setTimeout(function() {
|
this.timeout = setTimeout(function() {
|
||||||
if (self.hoverState == 'out') self.hide()
|
if (self.hoverState == 'out') self.hide()
|
||||||
|
19
js/tests/unit/bootstrap-tooltip.js
vendored
19
js/tests/unit/bootstrap-tooltip.js
vendored
@ -78,6 +78,25 @@ $(function () {
|
|||||||
}, 100)
|
}, 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 () {
|
test("should not show tooltip if leave event occurs before delay expires", function () {
|
||||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||||
.appendTo('#qunit-fixture')
|
.appendTo('#qunit-fixture')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user