Sha256: 49be6bcd99d1cfc18465749c549539fce6d17bd27a32943a96a367989f57e1f3

Contents?: true

Size: 1.33 KB

Versions: 36

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

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 "has 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 "has a title with a link for a11y" do
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to have_selector 'h3 a', text: 'Some Field'
  end

  it "is 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 "is 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

36 entries across 36 versions & 1 rubygems

Version Path
blacklight-6.25.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.24.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.23.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.22.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.21.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.20.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.19.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.19.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.19.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.18.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.17.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.16.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.15.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.14.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.14.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.13.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.12.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.11.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.11.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-6.11.0 spec/views/catalog/_facet_layout.html.erb_spec.rb