Sha256: 071be46062b55220c219d3825bf454e9f0e2af735ee33ec586be6f2505cf9895

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

describe "catalog/_index_header_default" do
  let :document do
    SolrDocument.new :id => 'xyz', :format => 'a'
  end

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

  before do
    allow(controller).to receive(:action_name).and_return('index')
    assign :response, double(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(:current_search_session).and_return nil
    allow(view).to receive(:search_session).and_return({})
  end

  it "renders the document header" do
    allow(view).to receive(:render_index_doc_actions)
    render partial: "catalog/index_header_default", 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_default", 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_default", 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

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-6.5.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.4.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.4.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.4.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.3.3 spec/views/catalog/_index_header_default.html.erb_spec.rb