aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/tooltip.js
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2015-04-21 17:41:06 -0700
committerChris Rebert <[email protected]>2015-04-25 13:16:53 -0700
commitfc372952e2983934dda338ffefd705112db8008a (patch)
tree42025bd7be075b00d02498fbc06d3c1af3a6814b /js/tests/unit/tooltip.js
parent8949bcecd2b298d67bce34705a5d235b155a9ba7 (diff)
downloadbootstrap-fc372952e2983934dda338ffefd705112db8008a.tar.xz
bootstrap-fc372952e2983934dda338ffefd705112db8008a.zip
Throw error when tooltip/popover template has multiple top-level elements
Closes #16219.
Diffstat (limited to 'js/tests/unit/tooltip.js')
-rw-r--r--js/tests/unit/tooltip.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 0cb964e9b..2c492a92b 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -1225,4 +1225,14 @@ $(function () {
assert.strictEqual($tooltip.data('bs.tooltip'), undefined, 'should not initialize the tooltip')
})
+ QUnit.test('should throw an error when template contains multiple top-level elements', function (assert) {
+ assert.expect(1)
+ assert.throws(function () {
+ $('<a href="#" data-toggle="tooltip" title="Another tooltip"></a>')
+ .appendTo('#qunit-fixture')
+ .bootstrapTooltip({ template: '<div>Foo</div><div>Bar</div>' })
+ .bootstrapTooltip('show')
+ }, new Error('tooltip `template` option must consist of exactly 1 top-level element!'))
+ })
+
})