Sha256: eb616ca732e042d808933c61cc7642f2f614d439156d174bb93769db325cb887

Contents?: true

Size: 1.48 KB

Versions: 22

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

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

  let :blacklight_config do
    Blacklight::Configuration.new
  end

  before do
    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 "should render 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 "should allow 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 "should give 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

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.19.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.19.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.18.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.17.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.0.0.pre5 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.17.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.17.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.0.0.pre4 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.16.4 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.0.0.pre3 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.16.3 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.16.2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.16.1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.0.0.pre2 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-6.0.0.pre1 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.16.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.15.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.14.0 spec/views/catalog/_index_header_default.html.erb_spec.rb
blacklight-5.13.1 spec/views/catalog/_index_header_default.html.erb_spec.rb