Skip to content

Commit

Permalink
Add test for popover.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanneculai committed Mar 24, 2014
1 parent 41628c9 commit 674b41d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions js/tests/unit/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,35 @@ $(function () {
$('#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 () {
$.support.transition = false
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
Expand Down

0 comments on commit 674b41d

Please sign in to comment.