Sha256: 3cbdedb0db9ceb0804f6697cf0d47db38b340daac58e93fb286a0a88098b869a

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe "catalog/facet_layout" do

  let :blacklight_config do
    Blacklight::Configuration.new
  end

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

  before do
    view.stub(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
    facet_field.stub(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

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-5.0.3 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.0.2 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.0.1 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.0.0 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.0.0.pre4 spec/views/catalog/_facet_layout.html.erb_spec.rb
blacklight-5.0.0.pre3 spec/views/catalog/_facet_layout.html.erb_spec.rb