0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

update click state when hiding so can be shown again by trigger. fixes #16732

This commit is contained in:
Max Beatty 2016-12-26 16:21:27 -08:00 committed by Mark Otto
parent 8a3d0d344b
commit aa7f95fd77
2 changed files with 25 additions and 0 deletions

View File

@ -358,6 +358,10 @@ const Tooltip = (($) => {
$(tip).removeClass(ClassName.SHOW) $(tip).removeClass(ClassName.SHOW)
this._activeTrigger[Trigger.CLICK] = false
this._activeTrigger[Trigger.FOCUS] = false
this._activeTrigger[Trigger.HOVER] = false
if (Util.supportsTransitionEnd() && if (Util.supportsTransitionEnd() &&
$(this.tip).hasClass(ClassName.FADE)) { $(this.tip).hasClass(ClassName.FADE)) {
this._isTransitioning = true this._isTransitioning = true

View File

@ -818,4 +818,25 @@ $(function () {
}) })
}) })
QUnit.test('should show on first trigger after hide', function (assert) {
assert.expect(3)
var $el = $('<a href="#" rel="tooltip" title="Test tooltip"/>')
.appendTo('#qunit-fixture')
.bootstrapTooltip({ trigger: 'click hover focus', animation: false })
var tooltip = $el.data('bs.tooltip')
var $tooltip = $(tooltip.getTipElement())
function showingTooltip() { return $tooltip.hasClass('show') || tooltip._hoverState === 'show' }
$el.trigger('click')
assert.ok(showingTooltip(), 'tooltip is faded in')
$el.bootstrapTooltip('hide')
assert.ok(!showingTooltip(), 'tooltip was faded out')
$el.trigger('click')
assert.ok(showingTooltip(), 'tooltip is faded in again')
})
}) })