2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

throw error when trying to show tooltip on :hidden element

This commit is contained in:
Chris Rebert
2014-12-16 16:40:54 -08:00
parent cfcc597c85
commit 0d77644fc4
3 changed files with 68 additions and 34 deletions
+13 -1
View File
@@ -166,7 +166,8 @@ $(function () {
QUnit.test('should destroy popover', function (assert) {
assert.expect(7)
var $popover = $('<div/>')
var $popover = $('<div>Popover trigger</div>')
.appendTo('#qunit-fixture')
.bootstrapPopover({
trigger: 'hover'
})
@@ -240,6 +241,17 @@ $(function () {
.bootstrapPopover('show')
})
QUnit.test('should throw an error when trying to show a popover on a hidden element', function (assert) {
assert.expect(1)
var $target = $('<a href="#" title="Another popover" data-content="Body" style="display: none;">I am hidden</a>').appendTo('#qunit-fixture')
assert.throws(function () {
$target.bootstrapPopover('show')
}, new Error('Can\'t show a tooltip/popover on a hidden element'))
$target.remove()
})
QUnit.test('should throw an error when initializing popover on the document object without specifying a delegation selector', function (assert) {
assert.expect(1)
assert.throws(function () {