Sha256: 34683b0f06a79b94585abe6b6f7aef7d4473946dea40590a636be60f82b657cc

Contents?: true

Size: 1.41 KB

Versions: 74

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/_index_header" do
  let :document do
    SolrDocument.new id: 'xyz', format: 'a'
  end

  let(:blacklight_config) { Blacklight::Configuration.new }

  before do
    assign :response, instance_double(Blacklight::Solr::Response, start: 0)
    allow(view).to receive(:render_grouped_response?).and_return false
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(view).to receive(:session_tracking_params).and_return({})
  end

  it "renders the document header" do
    allow(view).to receive(:render_index_doc_actions)
    render partial: "catalog/index_header", locals: { document: document, document_counter: 1 }
    expect(rendered).to have_selector('.document-counter', text: "2")
  end

  it "allows the title to take the whole space if no document tools are rendered" do
    allow(view).to receive(:render_index_doc_actions)
    render partial: "catalog/index_header", locals: { document: document, document_counter: 1 }
    expect(rendered).to have_selector '.index_title.col-md-12'
  end

  it "gives the document actions space if present" do
    allow(view).to receive(:render_index_doc_actions).and_return("DOCUMENT ACTIONS")
    render partial: "catalog/index_header", locals: { document: document, document_counter: 1 }
    expect(rendered).to have_selector '.index_title.col-sm-9'
    expect(rendered).to have_content "DOCUMENT ACTIONS"
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.39.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.38.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.37.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.36.2 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.36.1 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.36.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.35.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.34.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.33.1 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.33.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.32.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.31.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.30.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.29.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.28.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.27.1 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.27.0 spec/views/catalog/_index_header.html.erb_spec.rb
blacklight-7.26.1 spec/views/catalog/_index_header.html.erb_spec.rb