Sha256: b06af9e9024be7ceccdafb880c2ee1739d8c88bc5649bc21bbb3b8761de1b1cf

Contents?: true

Size: 1.59 KB

Versions: 19

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

describe 'Search Result Block', type: :feature, js: true do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }

  let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
  let!(:alt_search) { FactoryBot.create(:search, title: 'Alt. Search', exhibit: exhibit) }

  before do
    login_as exhibit_curator

    exhibit.searches.each { |x| x.update published: true }
    visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
    add_widget 'search_results'
  end

  it 'allows a curator to select from existing browse categories' do
    # Manually inject the inputs to the widget that the autocomplete would.
    # fill_in_typeahead_field does not work here for us for some reason.
    page.execute_script <<-JS
      $("[data-twitter-typeahead]:visible").after(
        "<input type='hidden' name='item[item_0][id]' value='all-exhibit-items' />" +
        "<input type='hidden' name='item[item_0][display]' value='true' />"
      );
    JS

    check 'Gallery'
    check 'Slideshow'

    save_page

    expect(page).not_to have_content 'per page'
    expect(page).not_to have_content 'Sort by'

    # The two configured view types should be
    # present and the one not selected should not be
    within('.view-type-group') do
      expect(page).not_to have_css('.view-type-list')
      expect(page).to have_css('.view-type-gallery')
      expect(page).to have_css('.view-type-slideshow')
    end

    # Documents should exist
    expect(page).to have_css('.documents .document')
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.2 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.1 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.4 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.3 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.2 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/features/javascript/blocks/search_result_block_spec.rb