[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 $(function () { 2 3 module("bootstrap-popover") 4 5 test("should be defined on jquery object", function () { 6 var div = $('<div></div>') 7 ok(div.popover, 'popover method is defined') 8 }) 9 10 test("should return element", function () { 11 var div = $('<div></div>') 12 ok(div.popover() == div, 'document.body returned') 13 }) 14 15 test("should render popover element", function () { 16 $.support.transition = false 17 var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') 18 .appendTo('#qunit-fixture') 19 .popover('show') 20 21 ok($('.popover').length, 'popover was inserted') 22 popover.popover('hide') 23 ok(!$(".popover").length, 'popover removed') 24 }) 25 26 test("should store popover instance in popover data object", function () { 27 $.support.transition = false 28 var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') 29 .popover() 30 31 ok(!!popover.data('popover'), 'popover instance exists') 32 }) 33 34 test("should get title and content from options", function () { 35 $.support.transition = false 36 var popover = $('<a href="#">@fat</a>') 37 .appendTo('#qunit-fixture') 38 .popover({ 39 title: function () { 40 return '@fat' 41 } 42 , content: function () { 43 return 'loves writing tests (╯°□°)╯︵ ┻━┻' 44 } 45 }) 46 47 popover.popover('show') 48 49 ok($('.popover').length, 'popover was inserted') 50 equals($('.popover .popover-title').text(), '@fat', 'title correctly inserted') 51 equals($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted') 52 53 popover.popover('hide') 54 ok(!$('.popover').length, 'popover was removed') 55 $('#qunit-fixture').empty() 56 }) 57 58 test("should get title and content from attributes", function () { 59 $.support.transition = false 60 var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>') 61 .appendTo('#qunit-fixture') 62 .popover() 63 .popover('show') 64 65 ok($('.popover').length, 'popover was inserted') 66 equals($('.popover .popover-title').text(), '@mdo', 'title correctly inserted') 67 equals($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted') 68 69 popover.popover('hide') 70 ok(!$('.popover').length, 'popover was removed') 71 $('#qunit-fixture').empty() 72 }) 73 74 test("should respect custom classes", function() { 75 $.support.transition = false 76 var popover = $('<a href="#">@fat</a>') 77 .appendTo('#qunit-fixture') 78 .popover({ 79 title: 'Test' 80 , content: 'Test' 81 , template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>' 82 }) 83 84 popover.popover('show') 85 86 ok($('.popover').length, 'popover was inserted') 87 ok($('.popover').hasClass('foobar'), 'custom class is present') 88 89 popover.popover('hide') 90 ok(!$('.popover').length, 'popover was removed') 91 $('#qunit-fixture').empty() 92 }) 93 })
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |