diff options
author | Thomas Park <thomas@thomaspark.me> | 2013-08-06 15:19:12 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2013-08-06 15:19:12 -0400 |
commit | 4642156cbc6da4a9e25dce2168f2fb9b726de042 (patch) | |
tree | d62aec0ebf977e008d016d8af15e54e26d5089b4 /2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js | |
parent | 20e2d90874a3e1116c76e1547210d191dd0159f4 (diff) |
unignore bower_components
Diffstat (limited to '2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js')
-rw-r--r-- | 2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js b/2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js new file mode 100644 index 00000000..20234e14 --- /dev/null +++ b/2/bower_components/bootstrap/js/tests/unit/bootstrap-popover.js @@ -0,0 +1,113 @@ +$(function () { + + module("bootstrap-popover") + + test("should provide no conflict", function () { + var popover = $.fn.popover.noConflict() + ok(!$.fn.popover, 'popover was set back to undefined (org value)') + $.fn.popover = popover + }) + + test("should be defined on jquery object", function () { + var div = $('<div></div>') + ok(div.popover, 'popover method is defined') + }) + + test("should return element", function () { + var div = $('<div></div>') + ok(div.popover() == div, 'document.body returned') + }) + + test("should render popover element", function () { + $.support.transition = false + var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') + .appendTo('#qunit-fixture') + .popover('show') + + ok($('.popover').length, 'popover was inserted') + popover.popover('hide') + ok(!$(".popover").length, 'popover removed') + }) + + test("should store popover instance in popover data object", function () { + $.support.transition = false + var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') + .popover() + + ok(!!popover.data('popover'), 'popover instance exists') + }) + + test("should get title and content from options", function () { + $.support.transition = false + var popover = $('<a href="#">@fat</a>') + .appendTo('#qunit-fixture') + .popover({ + title: function () { + return '@fat' + } + , content: function () { + return 'loves writing tests (╯°□°)╯︵ ┻━┻' + } + }) + + popover.popover('show') + + ok($('.popover').length, 'popover was inserted') + equals($('.popover .popover-title').text(), '@fat', 'title correctly inserted') + equals($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', '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>') + .appendTo('#qunit-fixture') + .popover() + .popover('show') + + ok($('.popover').length, 'popover was inserted') + equals($('.popover .popover-title').text(), '@mdo', 'title correctly inserted') + equals($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted') + + popover.popover('hide') + ok(!$('.popover').length, 'popover was removed') + $('#qunit-fixture').empty() + }) + + test("should respect custom classes", function() { + $.support.transition = false + var popover = $('<a href="#">@fat</a>') + .appendTo('#qunit-fixture') + .popover({ + title: 'Test' + , content: 'Test' + , template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>' + }) + + popover.popover('show') + + ok($('.popover').length, 'popover was inserted') + ok($('.popover').hasClass('foobar'), 'custom class is present') + + popover.popover('hide') + ok(!$('.popover').length, 'popover was removed') + $('#qunit-fixture').empty() + }) + + test("should destroy popover", function () { + var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function(){}) + ok(popover.data('popover'), 'popover has data') + ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event') + ok($._data(popover[0], 'events').click[0].namespace == 'foo', 'popover has extra click.foo event') + popover.popover('show') + popover.popover('destroy') + ok(!popover.hasClass('in'), 'popover is hidden') + ok(!popover.data('popover'), 'popover does not have data') + ok($._data(popover[0],'events').click[0].namespace == 'foo', 'popover still has click.foo') + ok(!$._data(popover[0], 'events').mouseover && !$._data(popover[0], 'events').mouseout, 'popover does not have any events') + }) + +})
\ No newline at end of file |