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

Popover - call content once if it's a function. (#24690)

This commit is contained in:
Johann-S
2017-11-07 08:18:52 +01:00
committed by XhmikosR
parent b42a38b886
commit 26dc17bcd2
2 changed files with 27 additions and 4 deletions

View File

@@ -410,4 +410,25 @@ $(function () {
$popover.trigger($.Event('click'))
}, 200)
})
QUnit.test('popover should call content function only once', function (assert) {
assert.expect(1)
var done = assert.async()
var nbCall = 0
$('<div id="popover" style="display:none">content</div>').appendTo('#qunit-fixture')
var $popover = $('<a href="#">@Johann-S</a>')
.appendTo('#qunit-fixture')
.bootstrapPopover({
content: function () {
nbCall++
return $('#popover').clone().show().get(0)
}
})
.on('shown.bs.popover', function () {
assert.strictEqual(nbCall, 1)
done()
})
$popover.trigger($.Event('click'))
})
})