$(function () { module('popover plugin') test('should be defined on jquery object', function () { var div = $('
') ok(div.popover, 'popover method is defined') }) module('popover', { setup: function() { // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode $.fn.bootstrapPopover = $.fn.popover.noConflict() }, teardown: function() { $.fn.popover = $.fn.bootstrapPopover delete $.fn.bootstrapPopover } }) test('should provide no conflict', function () { ok(!$.fn.popover, 'popover was set back to undefined (org value)') }) test('should return element', function () { var div = $('') ok(div.bootstrapPopover() == div, 'document.body returned') }) test('should render popover element', function () { $.support.transition = false var popover = $('@mdo') .appendTo('#qunit-fixture') .bootstrapPopover('show') ok($('.popover').length, 'popover was inserted') popover.bootstrapPopover('hide') ok(!$('.popover').length, 'popover removed') }) test('should store popover instance in popover data object', function () { $.support.transition = false var popover = $('@mdo') .bootstrapPopover() ok(!!popover.data('bs.popover'), 'popover instance exists') }) test('should get title and content from options', function () { $.support.transition = false var popover = $('@fat') .appendTo('#qunit-fixture') .bootstrapPopover({ title: function () { return '@fat' }, content: function () { return 'loves writing tests (╯°□°)╯︵ ┻━┻' } }) popover.bootstrapPopover('show') ok($('.popover').length, 'popover was inserted') equal($('.popover .popover-title').text(), '@fat', 'title correctly inserted') equal($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted') popover.bootstrapPopover('hide') ok(!$('.popover').length, 'popover was removed') $('#qunit-fixture').empty() }) test('should not duplicate HTML object', function () { $.support.transition = false $div = $('