Sha256: ba53c77d8e224115eea2beef33f25a8a5f8f39c02b2c8799e87770bad8367bae

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe "catalog/_view_type_group" do

  let :blacklight_config do
    Blacklight::Configuration.new
  end

  before do
    view.stub(blacklight_config: blacklight_config)
  end

  it "should not display the group when there's only one option" do
    blacklight_config.stub document_index_view_types: ['a']
    render partial: 'catalog/view_type_group'
    expect(rendered).to be_empty
  end

  it "should display the group" do
    blacklight_config.stub document_index_view_types: ['a', 'b', 'c']
    render partial: 'catalog/view_type_group'
    expect(rendered).to have_selector('.btn-group.view-type-group')
    expect(rendered).to have_selector('.view-type-a', :text => 'A')
    expect(rendered).to have_selector('.view-type-b', :text => 'B')
    expect(rendered).to have_selector('.view-type-c', :text => 'C')
  end


  it "should set the current view to 'active'" do
    blacklight_config.stub document_index_view_types: ['a', 'b']
    render partial: 'catalog/view_type_group'
    expect(rendered).to have_selector('.active', :text => 'A')
    expect(rendered).to_not have_selector('.active', :text => 'B')
    expect(rendered).to have_selector('.btn', :text => 'B')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-5.0.0.pre3 spec/views/catalog/_view_type_group.html.erb_spec.rb