Skip to content

Commit

Permalink
Merge pull request twbs#6349 from Yohn/patch-6
Browse files Browse the repository at this point in the history
Fixes twbs#5753 with tooltip('toogle')
  • Loading branch information
fat committed Dec 22, 2012
2 parents effba9e + a670524 commit d09b46f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@
}

, toggle: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
self[self.tip().hasClass('in') ? 'hide' : 'show']()
var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
self.tip().hasClass('in') ? self.hide() : self.show()
}

, destroy: function () {
Expand Down Expand Up @@ -290,4 +290,4 @@
return this
}

}(window.jQuery);
}(window.jQuery);
10 changes: 9 additions & 1 deletion js/tests/unit/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,12 @@ $(function () {
div.find('a').trigger('click')
ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
})
})

test("should show tooltip when toggle is called", function () {
var tooltip = $('<a href="#" rel="tooltip" title="tooltip on toggle"></a>')
.appendTo('#qunit-fixture')
.tooltip({trigger: 'manual'})
.tooltip('toggle')
ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in')
})
})

0 comments on commit d09b46f

Please sign in to comment.