Sha256: 6dbb2734d45c487bd70e2d0ecf5582dfbc360e3cb2a54bc23b610a493aed8367

Contents?: true

Size: 1.72 KB

Versions: 3

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe "Blacklight Range Limit" do

  it "should show the range limit facet" do
    visit catalog_index_path
    expect(page).to have_selector 'input.range_begin'
    expect(page).to have_selector 'input.range_end'
    expect(page).to have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'Publication Date Sort range begin'
    expect(page).to have_selector 'label.sr-only[for="range_pub_date_sort_end"]', :text => 'Publication Date Sort range end'
    expect(page).to have_button 'Limit'
  end

  it "should provide distribution information" do
    visit catalog_index_path
    click_link 'View distribution'

    expect(page).to have_content("1500 to 1599 0")
    expect(page).to have_content("2000 to 2008 12")
  end

  it "should limit appropriately" do
    visit catalog_index_path
    click_link 'View distribution'
    click_link '2000 to 2008'

    expect(page).to have_content "2000 to 2008 [remove] 12"
  end
end

describe "Blacklight Range Limit with configured input labels" do
  before do
    CatalogController.blacklight_config = Blacklight::Configuration.new
    CatalogController.configure_blacklight do |config|
      config.add_facet_field 'pub_date_sort', :range => {
        :input_label_range_begin => 'from publication date',
        :input_label_range_end => 'to publication date'
      }
      config.default_solr_params[:'facet.field'] = config.facet_fields.keys
    end  
  end    
  
  it "should show the range limit facet" do
    visit '/catalog'
    expect(page).to have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'from publication date'
    expect(page).to have_selector 'label.sr-only[for="range_pub_date_sort_end"]', :text => 'to publication date'
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_range_limit-5.2.0 spec/features/blacklight_range_limit_spec.rb
blacklight_range_limit-5.1.0 spec/features/blacklight_range_limit_spec.rb
blacklight_range_limit-5.0.4 spec/features/blacklight_range_limit_spec.rb