2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03:00

Throw error when tooltip/popover template has multiple top-level elements

Closes #16219.
This commit is contained in:
Chris Rebert
2015-04-21 17:41:06 -07:00
parent 8949bcecd2
commit fc372952e2
3 changed files with 28 additions and 1 deletions
+10
View File
@@ -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!'))
})
})