Sha256: e261d837a5817a45dcf5083a28c10c51a556e8837fa88d075cf1717198abe414

Contents?: true

Size: 1.77 KB

Versions: 5

Compression:

Stored size: 1.77 KB

Contents

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?hypothetical_existing_param=true&q=ignore+this+existing+query'
    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

5 entries across 5 versions & 1 rubygems

Version Path
blacklight_advanced_search-6.3.1 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-6.3.0 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-6.2.1 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-6.2.0 spec/features/blacklight_advanced_search_form_spec.rb
blacklight_advanced_search-6.1.0 spec/features/blacklight_advanced_search_form_spec.rb