Sha256: 67c030a06fd7eb56e05a004cd93fa428c787bc0047f715c530956bed8b738516

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 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-gallery .document')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.3.0 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.2.0 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.1.0 spec/features/javascript/blocks/search_result_block_spec.rb
blacklight-spotlight-3.0.3 spec/features/javascript/blocks/search_result_block_spec.rb