Sha256: 6f4737ec9caeb289636b705d7e8a3f6a0faa374be2537b03de030c025c2f688d

Contents?: true

Size: 1.52 KB

Versions: 52

Compression:

Stored size: 1.52 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"][data-bs-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"][data-bs-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

52 entries across 52 versions & 2 rubygems

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