Sha256: 212649313cb487ec87915b883f3406eb002e2f6a4efeba10b19c26f1debb23ff

Contents?: true

Size: 1.56 KB

Versions: 31

Compression:

Stored size: 1.56 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, 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(: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

31 entries across 31 versions & 1 rubygems

Version Path
blacklight-6.25.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.24.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.23.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.22.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.21.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.20.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.19.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.19.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.19.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.18.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.17.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.16.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.15.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.14.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.14.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.13.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.12.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.11.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.11.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.11.0 spec/views/catalog/_index_header_default.html.erb_spec.rb