Sha256: 2ff8ac723a27deba81bbe4a101abc0c99cc4860fbecca0579a48366341d3e29c

Contents?: true

Size: 1.66 KB

Versions: 5

Compression:

Stored size: 1.66 KB

Contents

require "spec_helper"

feature "Metadata Administration", js: true do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
  before { login_as admin }
  describe "Select/Deselect all button" do
    it "should deselect all checkboxes when all are selected" do
      visit spotlight.exhibit_edit_metadata_path exhibit
      # No checkboxes should be unchecked
      expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)")
      within("tr th:nth-child(2)") do
        click_button "Deselect all"
        expect(page).to have_css("button", text: "Select all", visible: true)
      end
      # No checkboxes should be checked
      expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:checked")
    end
    it "should select all checkboxes when any are unselected" do
      visit spotlight.exhibit_edit_metadata_path exhibit
      # No checkboxes should be unchecked
      expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)")
      first_button_area = find("tr th:nth-child(2)")
      within first_button_area do
        expect(page).to have_css("button", text: "Deselect all")
      end
      # Uncheck first checkbox
      find("tr:first-child td:nth-child(2) input[type='checkbox']").set(false)
      # A checkbox should be checked
      expect(page).to have_css("tr td:nth-child(2) input[type='checkbox']:checked")
      within first_button_area do
        click_button "Select all"
      end
      # No checkboxes should be unchecked
      expect(page).not_to have_css("tr td:nth-child(2) input[type='checkbox']:not(:checked)")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.3.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.3.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.2.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.1.0 spec/features/javascript/metadata_admin_spec.rb