Sha256: c37b58f3f7b532d9abeef0e8ffa933edb26431029aaf78c7d975eadb48862288

Contents?: true

Size: 1.97 KB

Versions: 56

Compression:

Stored size: 1.97 KB

Contents

$(function () {

    module("bootstrap-dropdowns")

      test("should be defined on jquery object", function () {
        ok($(document.body).dropdown, 'dropdown method is defined')
      })

      test("should return element", function () {
        ok($(document.body).dropdown()[0] == document.body, 'document.body returned')
      })

      test("should add class open to menu if clicked", function () {
        var dropdownHTML = '<ul class="tabs">'
          + '<li class="dropdown">'
          + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
          + '<ul class="dropdown-menu">'
          + '<li><a href="#">Secondary link</a></li>'
          + '<li><a href="#">Something else here</a></li>'
          + '<li class="divider"></li>'
          + '<li><a href="#">Another link</a></li>'
          + '</ul>'
          + '</li>'
          + '</ul>'
          , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()

        ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
      })

      test("should remove open class if body clicked", function () {
        var dropdownHTML = '<ul class="tabs">'
          + '<li class="dropdown">'
          + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
          + '<ul class="dropdown-menu">'
          + '<li><a href="#">Secondary link</a></li>'
          + '<li><a href="#">Something else here</a></li>'
          + '<li class="divider"></li>'
          + '<li><a href="#">Another link</a></li>'
          + '</ul>'
          + '</li>'
          + '</ul>'
          , dropdown = $(dropdownHTML)
            .appendTo('#qunit-fixture')
            .find('[data-toggle="dropdown"]')
            .dropdown()
            .click()
        ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
        $('body').click()
        ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
        dropdown.remove()
      })

})

Version data entries

56 entries across 56 versions & 3 rubygems

Version Path
spiderfw-1.0.1 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-1.0.0 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.39 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.38 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.37 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.35 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.34 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.33 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.32 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.31 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.30 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.29 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.28 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.27 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
bootstrapped-rails-2.0.8.1 vendor/assets/twitter/js/tests/unit/bootstrap-dropdown.js
bootstrapped-rails-2.0.8 vendor/assets/twitter/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.26 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
spiderfw-0.6.26.pre1 apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js
bootstrapped-rails-2.0.7.9 vendor/assets/twitter/js/tests/unit/bootstrap-dropdown.js
bootstrapped-rails-2.0.7.8 vendor/assets/twitter/js/tests/unit/bootstrap-dropdown.js