diff options
| author | Chris Rebert <[email protected]> | 2014-05-23 14:33:19 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-05-23 14:33:19 -0700 |
| commit | bc1ce426d9dc831f5363369de723ef328e71f297 (patch) | |
| tree | d8218b2004eb78b4054eaf8b3a30b5d5a3d9c1ba | |
| parent | ef6225491729ee3ec3804250e3dddb69cc95fba0 (diff) | |
| parent | 122c05dbd87d9708086da4d097f7e715233f3b2c (diff) | |
| download | bootstrap-bc1ce426d9dc831f5363369de723ef328e71f297.tar.xz bootstrap-bc1ce426d9dc831f5363369de723ef328e71f297.zip | |
Merge pull request #13593 from ResentedHook/master
Add tooltip self-reference to address #12320
| -rw-r--r-- | js/tests/unit/popover.js | 10 | ||||
| -rw-r--r-- | js/tests/unit/tooltip.js | 11 | ||||
| -rw-r--r-- | js/tooltip.js | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 1a095564b..b28e1f3a7 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -46,6 +46,16 @@ $(function () { ok(!!popover.data('bs.popover'), 'popover instance exists') }) + test('should store popover trigger in popover instance data object', function () { + $.support.transition = false + var popover = $('<a href="#" title="ResentedHook">@ResentedHook</a>') + .appendTo('#qunit-fixture') + .bootstrapPopover() + popover.bootstrapPopover('show') + ok(!!$('.popover').data('bs.popover'), 'popover trigger stored in instance data') + $('#qunit-fixture').empty() + }) + test('should get title and content from options', function () { $.support.transition = false var popover = $('<a href="#">@fat</a>') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index e95b91cbb..79e120691 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -325,6 +325,17 @@ $(function () { ok($('.tooltip').is('.fade.in'), 'tooltip should be toggled in') }) + test('should hide shown tooltip when toggle is called on tooltip', function () { + var tooltip = $('<a href="#" rel="tooltip" title="tooltip on toggle">@ResentedHook</a>') + .appendTo('#qunit-fixture') + .bootstrapTooltip({trigger: 'manual'}) + .bootstrapTooltip('toggle') + $('.tooltip', '#qunit-fixture').bootstrapTooltip('toggle') + ok($('.tooltip').not('.fade.in'), 'tooltip should be toggled out') + tooltip.bootstrapTooltip('hide') + $('#qunit-fixture').empty() + }) + test('should place tooltips inside the body', function () { var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>') .appendTo('#qunit-fixture') diff --git a/js/tooltip.js b/js/tooltip.js index 936424830..f0f8a7c18 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -170,6 +170,7 @@ .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) + .data('bs.' + this.type, this) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) |
