From e21b6459ad162296f94b2d9aeaf8807a153d3c8a Mon Sep 17 00:00:00 2001 From: Yohn Date: Thu, 20 Dec 2012 04:34:28 -0500 Subject: [PATCH 1/2] fixes tooltip('toggle') --- js/bootstrap-tooltip.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 25bba15892..221d3ef7b6 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -234,8 +234,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 () { @@ -282,4 +282,4 @@ return this } -}(window.jQuery); \ No newline at end of file +}(window.jQuery); From a6705246d048ade327c5f93b4cc610ffbba86ee6 Mon Sep 17 00:00:00 2001 From: Yohn Date: Thu, 20 Dec 2012 04:36:57 -0500 Subject: [PATCH 2/2] Update js/tests/unit/bootstrap-tooltip.js --- js/tests/unit/bootstrap-tooltip.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index ba51347433..c44f75757a 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -156,4 +156,12 @@ $(function () { div.find('a').trigger('click') ok($(".tooltip").is('.fade.in'), 'tooltip is faded in') }) -}) \ No newline at end of file + + test("should show tooltip when toggle is called", function () { + var tooltip = $('') + .appendTo('#qunit-fixture') + .tooltip({trigger: 'manual'}) + .tooltip('toggle') + ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in') + }) +})