1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-17 19:06:40 +02:00

Making .tooltip('show') throw an error on elements with display:none (#20940)

This commit is contained in:
Johann
2016-11-01 04:33:53 +01:00
committed by Mark Otto
parent 0974267b8c
commit a7f1b59959
3 changed files with 28 additions and 0 deletions

View File

@@ -320,4 +320,16 @@ $(function () {
.bootstrapPopover('show')
})
QUnit.test('should throw an error when show is called on hidden elements', function (assert) {
assert.expect(1)
var done = assert.async()
try {
$('<div data-toggle="popover" data-title="some title" data-content="@Johann-S" style="display: none"/>').bootstrapPopover('show')
}
catch (err) {
assert.strictEqual(err.message, 'Please use show on visible elements')
done()
}
})
})

View File

@@ -185,6 +185,19 @@ $(function () {
.bootstrapTooltip('show')
})
QUnit.test('should throw an error when show is called on hidden elements', function (assert) {
assert.expect(1)
var done = assert.async()
try {
$('<div title="tooltip title" style="display: none"/>').bootstrapTooltip('show')
}
catch (err) {
assert.strictEqual(err.message, 'Please use show on visible elements')
done()
}
})
QUnit.test('should fire inserted event', function (assert) {
assert.expect(2)
var done = assert.async()