mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-28 10:24:19 +01:00
fixes #8399 w/ tests
This commit is contained in:
parent
930c75e5dd
commit
eaefed517a
6
dist/js/bootstrap.js
vendored
6
dist/js/bootstrap.js
vendored
@ -390,7 +390,7 @@
|
||||
$next[0].offsetWidth // force reflow
|
||||
$active.addClass(direction)
|
||||
$next.addClass(direction)
|
||||
this.$element.find('.item')
|
||||
$active
|
||||
.one($.support.transition.end, function () {
|
||||
$next.removeClass([type, direction].join(' ')).addClass('active')
|
||||
$active.removeClass(['active', direction].join(' '))
|
||||
@ -1138,10 +1138,10 @@
|
||||
var self = obj instanceof this.constructor ?
|
||||
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
clearTimeout(self.timeout)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
self.hoverState = 'in'
|
||||
self.timeout = setTimeout(function () {
|
||||
if (self.hoverState == 'in') self.show()
|
||||
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -130,7 +130,7 @@
|
||||
$next[0].offsetWidth // force reflow
|
||||
$active.addClass(direction)
|
||||
$next.addClass(direction)
|
||||
this.$element.find('.item')
|
||||
$active
|
||||
.one($.support.transition.end, function () {
|
||||
$next.removeClass([type, direction].join(' ')).addClass('active')
|
||||
$active.removeClass(['active', direction].join(' '))
|
||||
|
@ -181,6 +181,51 @@ $(function () {
|
||||
}, 100)
|
||||
})
|
||||
|
||||
test("should wait 200 ms before hiding the tooltip", 3, function () {
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||
.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 = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||
.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 = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
|
@ -102,10 +102,10 @@
|
||||
var self = obj instanceof this.constructor ?
|
||||
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
clearTimeout(self.timeout)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
self.hoverState = 'in'
|
||||
self.timeout = setTimeout(function () {
|
||||
if (self.hoverState == 'in') self.show()
|
||||
|
Loading…
Reference in New Issue
Block a user