diff options
| author | Chris Rebert <[email protected]> | 2015-04-21 21:40:14 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2015-04-21 21:40:14 -0700 |
| commit | c6b62f0cd99f66e716bffaf306fe3ddbe5decfc0 (patch) | |
| tree | bda8485ce567c60e10e21c1810a1f166a0f51f9b /js | |
| parent | 7993251b1c3c160e0a7553175cedf35f103fa928 (diff) | |
| parent | 3d71eae3011b10daa558baf494b019925fee5f60 (diff) | |
| download | bootstrap-c6b62f0cd99f66e716bffaf306fe3ddbe5decfc0.tar.xz bootstrap-c6b62f0cd99f66e716bffaf306fe3ddbe5decfc0.zip | |
Merge pull request #16147 from Johann-S/event_inserted
Fixes #16124.
Diffstat (limited to 'js')
| -rw-r--r-- | js/tests/unit/popover.js | 17 | ||||
| -rw-r--r-- | js/tests/unit/tooltip.js | 14 | ||||
| -rw-r--r-- | js/tooltip.js | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index fbabab9e3..2c3fd0cb0 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -259,4 +259,21 @@ $(function () { assert.strictEqual($popover.data('bs.popover'), undefined, 'should not initialize the popover') }) + QUnit.test('should fire inserted event', function (assert) { + assert.expect(2) + var done = assert.async() + + $('<a href="#">@Johann-S</a>') + .appendTo('#qunit-fixture') + .on('inserted.bs.popover', function () { + assert.notEqual($('.popover').length, 0, 'popover was inserted') + assert.ok(true, 'inserted event fired') + done() + }) + .bootstrapPopover({ + title: 'Test', + content: 'Test' + }) + .bootstrapPopover('show') + }) }) diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 57a59db18..8086631c8 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -139,6 +139,20 @@ $(function () { .bootstrapTooltip('show') }) + QUnit.test('should fire inserted event', function (assert) { + assert.expect(2) + var done = assert.async() + + $('<div title="tooltip title"/>') + .appendTo('#qunit-fixture') + .on('inserted.bs.tooltip', function () { + assert.notEqual($('.tooltip').length, 0, 'tooltip was inserted') + assert.ok(true, 'inserted event fired') + done() + }) + .bootstrapTooltip('show') + }) + QUnit.test('should fire shown event', function (assert) { assert.expect(1) var done = assert.async() diff --git a/js/tooltip.js b/js/tooltip.js index 789d04f7a..bbff2cdec 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -185,6 +185,7 @@ .data('bs.' + this.type, this) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + this.$element.trigger('inserted.bs.' + this.type) var pos = this.getPosition() var actualWidth = $tip[0].offsetWidth |
