[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/bootstrap/js/tests/unit/ -> bootstrap-tooltip.js (source)

   1  $(function () {
   2  
   3      module("bootstrap-tooltip")
   4  
   5        test("should be defined on jquery object", function () {
   6          var div = $("<div></div>")
   7          ok(div.tooltip, 'popover method is defined')
   8        })
   9  
  10        test("should return element", function () {
  11          var div = $("<div></div>")
  12          ok(div.tooltip() == div, 'document.body returned')
  13        })
  14  
  15        test("should expose default settings", function () {
  16          ok(!!$.fn.tooltip.defaults, 'defaults is defined')
  17        })
  18  
  19        test("should remove title attribute", function () {
  20          var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
  21          ok(!tooltip.attr('title'), 'title tag was removed')
  22        })
  23  
  24        test("should add data attribute for referencing original title", function () {
  25          var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
  26          equals(tooltip.attr('data-original-title'), 'Another tooltip', 'original title preserved in data attribute')
  27        })
  28  
  29        test("should place tooltips relative to placement option", function () {
  30          $.support.transition = false
  31          var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
  32            .appendTo('#qunit-fixture')
  33            .tooltip({placement: 'bottom'})
  34            .tooltip('show')
  35  
  36          ok($(".tooltip").hasClass('fade bottom in'), 'has correct classes applied')
  37          tooltip.tooltip('hide')
  38        })
  39  
  40        test("should always allow html entities", function () {
  41          $.support.transition = false
  42          var tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"></a>')
  43            .appendTo('#qunit-fixture')
  44            .tooltip('show')
  45  
  46          ok($('.tooltip b').length, 'b tag was inserted')
  47          tooltip.tooltip('hide')
  48          ok(!$(".tooltip").length, 'tooltip removed')
  49        })
  50  
  51        test("should respect custom classes", function () {
  52          var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
  53            .appendTo('#qunit-fixture')
  54            .tooltip({ template: '<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>'})
  55            .tooltip('show')
  56  
  57          ok($('.tooltip').hasClass('some-class'), 'custom class is present')
  58          tooltip.tooltip('hide')
  59          ok(!$(".tooltip").length, 'tooltip removed')
  60        })
  61  
  62  })


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1