Sha256: 3e831f343e65671ae497d7bc4baa39676d2613598704daede200a95b74d46d37

Contents?: true

Size: 1.08 KB

Versions: 51

Compression:

Stored size: 1.08 KB

Contents

describe "AA.TableCheckboxToggler", ->
  
  beforeEach ->
    loadFixtures('table_checkboxes.html');

    @collection = $("#collection")
    @toggle_all = @collection.find(".toggle_all")

    @checkboxes = @collection.find(":checkbox").not(@toggle_all)
    
    new AA.TableCheckboxToggler({}, @collection)

  describe "'selected' class for table row", ->
    it "should add the class 'selected' to rows when their checkbox is checked ", ->
      checkbox = $("#item_1")
      checkbox.attr("checked", "checked")      
      checkbox.trigger("change")

      expect(checkbox.parents("tr")).toHaveAttr("class", "selected")

    it "should remove the class 'selected' from rows when their checkbox is unchecked ", ->
      checkbox = $("#item_1")
      checkbox.trigger("change")

      expect(checkbox.parents("tr")).not.toHaveAttr("class", "selected")

  describe "clicking a cell", ->
    it "should toggle the checkbox when a cell is clicked", ->
      checkbox = $("#item_1")
      row = checkbox.parents("td")
      $(row).trigger("click")

      expect(checkbox).toHaveAttr("checked", "checked")

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
aa-rails4-0.6.0 spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.141 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.136 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.135 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.134 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.133 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.132 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.131 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.129 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.128 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.126 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.125 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.124 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.123 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.118 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.116 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.114 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.113 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.111 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee
lalala-4.0.0.dev.109 vendor/deps/active_admin/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee