Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/bootstrap-tooltip.js5
-rw-r--r--js/tests/unit/bootstrap-tooltip.js8
2 files changed, 11 insertions, 2 deletions
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js
index 14e48c856b..d5c2def29f 100644
--- a/js/bootstrap-tooltip.js
+++ b/js/bootstrap-tooltip.js
@@ -235,8 +235,9 @@
this.enabled = !this.enabled
}
- , toggle: function () {
- this[this.tip().hasClass('in') ? 'hide' : 'show']()
+ , toggle: function (e) {
+ var self = $(e.currentTarget)[this.type](this._options).data(this.type)
+ self[self.tip().hasClass('in') ? 'hide' : 'show']()
}
, destroy: function () {
diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js
index 964ba1ef26..bbdf3ce80f 100644
--- a/js/tests/unit/bootstrap-tooltip.js
+++ b/js/tests/unit/bootstrap-tooltip.js
@@ -142,4 +142,12 @@ $(function () {
ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
})
+ test("should show tooltip with delegate selector on click", function () {
+ var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
+ var tooltip = div.appendTo('#qunit-fixture')
+ .tooltip({ selector: 'a[rel=tooltip]',
+ trigger: 'click' })
+ div.find('a').trigger('click')
+ ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
+ })
}) \ No newline at end of file