Sha256: 6df74824e6efb7effd7cd6be4966de98ef7846639c7f17bbecff31a9fdc20faa

Contents?: true

Size: 1.72 KB

Versions: 48

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

RSpec.describe "Facet missing" do
  before do
    CatalogController.blacklight_config[:default_solr_params]["facet.missing"] = true
  end

  after do
    CatalogController.blacklight_config[:default_solr_params].delete("facet.missing")
  end

  context "selecting missing field in facets" do
    it "adds facet missing query and constraints" do
      visit root_path

      within "#facet-subject_geo_ssim" do
        click_link "[Missing]"
      end

      within "#facet-subject_geo_ssim" do
        expect(page).to have_selector("span.selected", text: "[Missing")
        expect(page).to have_selector("span.facet-count.selected", text: "13")
      end

      within "#sortAndPerPage" do
        expect(page).to have_content "1 - 10 of 13"
      end

      expect(page).to have_css(".constraint-value", text: "Region")
      expect(page).to have_css(".constraint-value", text: "[Missing]")
    end
  end

  context "unselecting the facet missing facet" do
    it "unselects the missing field facet" do
      visit root_path

      within "#facet-subject_geo_ssim" do
        click_link "[Missing]"
      end

      within "#facet-subject_geo_ssim" do
        click_link "remove"
      end

      expect(page).not_to have_link "remove"
      expect(page).to have_content("Welcome!")
    end
  end

  context "unselecting the facet missing constraint" do
    it "unselects the missing field facet" do
      visit root_path

      within "#facet-subject_geo_ssim" do
        click_link "[Missing]"
      end

      within ".filter-subject_geo_ssim" do
        click_link "Remove constraint Region: [Missing]"
      end

      expect(page).not_to have_link "remove"
      expect(page).to have_content("Welcome!")
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/features/facet_missing_spec.rb
blacklight-7.39.0 spec/features/facet_missing_spec.rb
blacklight-7.38.0 spec/features/facet_missing_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/features/facet_missing_spec.rb
blacklight-8.2.2 spec/features/facet_missing_spec.rb
blacklight-8.2.1 spec/features/facet_missing_spec.rb
blacklight-8.2.0 spec/features/facet_missing_spec.rb
blacklight-7.37.0 spec/features/facet_missing_spec.rb
blacklight-7.36.2 spec/features/facet_missing_spec.rb
blacklight-7.36.1 spec/features/facet_missing_spec.rb
blacklight-7.36.0 spec/features/facet_missing_spec.rb
blacklight-7.35.0 spec/features/facet_missing_spec.rb
blacklight-8.1.0 spec/features/facet_missing_spec.rb
blacklight-7.34.0 spec/features/facet_missing_spec.rb
blacklight-8.0.1 spec/features/facet_missing_spec.rb
blacklight-8.0.0 spec/features/facet_missing_spec.rb
blacklight-8.0.0.beta8 spec/features/facet_missing_spec.rb
blacklight-8.0.0.beta7 spec/features/facet_missing_spec.rb
blacklight-8.0.0.beta6 spec/features/facet_missing_spec.rb
blacklight-8.0.0.beta5 spec/features/facet_missing_spec.rb