Sha256: 916a5242aa268f090299a52561f95721539ff1be6036c6b6dd9999bb765f7d7f

Contents?: true

Size: 1.68 KB

Versions: 5

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

feature 'Metadata Administration', js: true do
  let(:exhibit) { FactoryGirl.create(:default_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

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-0.7.2 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.7.1 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.7.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.6.0 spec/features/javascript/metadata_admin_spec.rb
blacklight-spotlight-0.5.0 spec/features/javascript/metadata_admin_spec.rb