Sha256: 4c8a8487ee8b8b066c477c4b055063d673b54b2d3016d4791be77329e4ac2bbb

Contents?: true

Size: 1.47 KB

Versions: 28

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true

RSpec.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', text: 'Some Field'
  end

  it "is collapsable" do
    render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
    expect(rendered).to have_selector 'button.collapsed[data-toggle="collapse"][aria-expanded="false"]'
    expect(rendered).to have_selector '.collapse .card-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 have_selector 'button[data-toggle="collapse"][aria-expanded="true"]'
    expect(rendered).not_to have_selector '.card-header.collapsed'
    expect(rendered).to have_selector '.collapse.show .card-body'
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
blacklight-7.19.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.18.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.18.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.17.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.17.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.17.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.16.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.15.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.15.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.15.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.14.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.14.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.13.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.13.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.13.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.12.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.12.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.11.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.10.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-7.9.0 spec/views/catalog/_facet_layout.html.erb_spec.rb