Sha256: f2e20f8a02165b1c4055433a111fabfea4dceba3e1d8ba7e6b7b57f7eddeab86

Contents?: true

Size: 1.73 KB

Versions: 3

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

describe "Blacklight Advanced Search Form" do
  before(:all) do
    AdvancedController.copy_blacklight_config_from(CatalogController)
  end

  describe "advanced search form" do
    before do
      visit '/advanced'
    end

    it "should have field and facet blocks" do
      expect(page).to have_selector('.query-criteria')
      expect(page).to have_selector('.limit-criteria')
    end

    describe "query column" do
      it "should give the user a choice between and/or queries" do
        expect(page).to have_selector('#op')
        within('#op') do
          expect(page).to have_selector('option[value="AND"]')
          expect(page).to have_selector('option[value="OR"]')
        end
      end

      it "should list the configured search fields" do
        expect(page).to have_selector '.advanced-search-field #title'
        expect(page).to have_selector '.advanced-search-field #author'
      end

      it "should not list the search fields listed as not to be included in adv search" do
        expect(page).not_to have_selector '.advanced_search_field #dummy_field'
      end
    end

    describe "facet column" do
      it "should list facets" do
        expect(page).to have_selector('.blacklight-language_facet')

        within('.blacklight-language_facet') do
          expect(page).to have_content "Language Facet"
        end
      end
    end

    it "scope searches to fields" do
      fill_in "title", :with => "Medicine"
      click_on "advanced-search-submit"
      expect(page).to have_content "Remove constraint Title: Medicine"
      expect(page).to have_content "2007020969"
    end
  end

  it "should show the search fields" do
    visit '/advanced'
    expect(page).to have_selector('input#title')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_advanced_search-5.1.4 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-5.1.3 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-5.1.2 spec/features/blacklight_advanced_search_form_spec.rb