mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 17:14:04 +02:00
Add test for popover.
This commit is contained in:
@@ -61,6 +61,35 @@ $(function () {
|
|||||||
$('#qunit-fixture').empty()
|
$('#qunit-fixture').empty()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('should not duplicate HTML object', function () {
|
||||||
|
$.support.transition = false
|
||||||
|
|
||||||
|
$div = $('<div>').html('loves writing tests (╯°□°)╯︵ ┻━┻')
|
||||||
|
|
||||||
|
var popover = $('<a href="#">@fat</a>')
|
||||||
|
.appendTo('#qunit-fixture')
|
||||||
|
.popover({
|
||||||
|
content: function () {
|
||||||
|
return $div
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
popover.popover('show')
|
||||||
|
ok($('.popover').length, 'popover was inserted')
|
||||||
|
equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||||
|
|
||||||
|
popover.popover('hide')
|
||||||
|
ok(!$('.popover').length, 'popover was removed')
|
||||||
|
|
||||||
|
popover.popover('show')
|
||||||
|
ok($('.popover').length, 'popover was inserted')
|
||||||
|
equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||||
|
|
||||||
|
popover.popover('hide')
|
||||||
|
ok(!$('.popover').length, 'popover was removed')
|
||||||
|
$('#qunit-fixture').empty()
|
||||||
|
})
|
||||||
|
|
||||||
test('should get title and content from attributes', function () {
|
test('should get title and content from attributes', function () {
|
||||||
$.support.transition = false
|
$.support.transition = false
|
||||||
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||||
|
Reference in New Issue
Block a user