Sha256: 1bed4311b0f501269579e4244602a208eb2bdb3f76f465b0977c20952999f77e

Contents?: true

Size: 1.35 KB

Versions: 41

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe "catalog/facet_layout" do

  let :blacklight_config do
    Blacklight::Configuration.new do |config|
      config.facet_fields[facet_field.field] = facet_field
    end
  end

  let :facet_field do
    Blacklight::Configuration::FacetField.new(field: 'some_field').normalize!
  end

  before do
    allow(view).to receive_messages(blacklight_config: blacklight_config)
  end

  it "should have a facet-specific class" do
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to have_selector '.blacklight-some_field' 
  end

  it "should have a title with a link for a11y" do
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to have_selector 'h5 a', text: 'Some Field'
  end

  it "should be collapsable" do
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to have_selector '.panel-heading.collapsed'
    expect(rendered).to have_selector '.collapse .panel-body'
  end

  it "should be configured to be open by default" do
    allow(facet_field).to receive_messages(collapse: false)
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to_not have_selector '.panel-heading.collapsed'
    expect(rendered).to have_selector '.in .panel-body'

  end


end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.19.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.19.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.18.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.17.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.17.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.17.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.16.4 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.16.3 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.16.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.16.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.16.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.15.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.14.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.13.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.13.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.11.3 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.12.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.12.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.10.3 spec/views/catalog/_facet_layout.html.erb_spec.rb