Sha256: e053b22a5c349c3b2a2117eee6184bdd89a7231c29509cee53f33656a732ff0b

Contents?: true

Size: 1.68 KB

Versions: 22

Compression:

Stored size: 1.68 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 'deselects all checkboxes when all are selected' do
      visit spotlight.edit_exhibit_metadata_configuration_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 'selects all checkboxes when any are unselected' do
      visit spotlight.edit_exhibit_metadata_configuration_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

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-0.18.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.17.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.17.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.16.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.15.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.14.2 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.14.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.14.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.13.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.12.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.12.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.11.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.10.3 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.10.2 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.10.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.10.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.9.2 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.9.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.9.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.8.2 spec/features/javascript/metadata_admin_spec.rb