[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

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

   1  $(function () {
   2  
   3      module("bootstrap-buttons")
   4  
   5        test("should be defined on jquery object", function () {
   6          ok($(document.body).button, 'button method is defined')
   7        })
   8  
   9        test("should return element", function () {
  10          ok($(document.body).button()[0] == document.body, 'document.body returned')
  11        })
  12  
  13        test("should return set state to loading", function () {
  14          var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
  15          equals(btn.html(), 'mdo', 'btn text equals mdo')
  16          btn.button('loading')
  17          equals(btn.html(), 'fat', 'btn text equals fat')
  18          stop()
  19          setTimeout(function () {
  20            ok(btn.attr('disabled'), 'btn is disabled')
  21            ok(btn.hasClass('disabled'), 'btn has disabled class')
  22            start()
  23          }, 0)
  24        })
  25  
  26        test("should return reset state", function () {
  27          var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
  28          equals(btn.html(), 'mdo', 'btn text equals mdo')
  29          btn.button('loading')
  30          equals(btn.html(), 'fat', 'btn text equals fat')
  31          stop()
  32          setTimeout(function () {
  33            ok(btn.attr('disabled'), 'btn is disabled')
  34            ok(btn.hasClass('disabled'), 'btn has disabled class')
  35            start()
  36            stop()
  37          }, 0)
  38          btn.button('reset')
  39          equals(btn.html(), 'mdo', 'btn text equals mdo')
  40          setTimeout(function () {
  41            ok(!btn.attr('disabled'), 'btn is not disabled')
  42            ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
  43            start()
  44          }, 0)
  45        })
  46  
  47        test("should toggle active", function () {
  48          var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
  49          ok(!btn.hasClass('active'), 'btn does not have active class')
  50          btn.button('toggle')
  51          ok(btn.hasClass('active'), 'btn has class active')
  52        })
  53  
  54  })


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