mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-10 07:37:27 +02:00
Merge pull request #6349 from Yohn/patch-6
Fixes #5753 with tooltip('toogle')
This commit is contained in:
6
js/bootstrap-tooltip.js
vendored
6
js/bootstrap-tooltip.js
vendored
@@ -242,8 +242,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, toggle: function (e) {
|
, toggle: function (e) {
|
||||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
|
||||||
self[self.tip().hasClass('in') ? 'hide' : 'show']()
|
self.tip().hasClass('in') ? self.hide() : self.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
, destroy: function () {
|
, destroy: function () {
|
||||||
@@ -290,4 +290,4 @@
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
10
js/tests/unit/bootstrap-tooltip.js
vendored
10
js/tests/unit/bootstrap-tooltip.js
vendored
@@ -156,4 +156,12 @@ $(function () {
|
|||||||
div.find('a').trigger('click')
|
div.find('a').trigger('click')
|
||||||
ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
|
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')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Reference in New Issue
Block a user