From: Stefan Neculai Date: Mon, 24 Mar 2014 17:49:06 +0000 (+0200) Subject: Add test for popover. X-Git-Tag: v3.2.0~317^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=674b41dd632d4911d291a593a23a5563a1a67811;p=thirdparty%2Fbootstrap.git Add test for popover. --- diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index c08b6d8ef2..24f2f6f03e 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -61,6 +61,35 @@ $(function () { $('#qunit-fixture').empty() }) + test('should not duplicate HTML object', function () { + $.support.transition = false + + $div = $('
').html('loves writing tests (╯°□°)╯︵ ┻━┻') + + var popover = $('@fat') + .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 = $('@mdo')