Sha256: 949c9886793e3995a173f32caaedaf0e87367220be864085ce4a5724e2787289

Contents?: true

Size: 1.25 KB

Versions: 13

Compression:

Stored size: 1.25 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
    render partial: 'catalog/view_type_group'
    expect(rendered).to be_empty
  end

  it "should display the group" do
    blacklight_config.configure do |config|
      config.view.delete(:list)
      config.view.a 
      config.view.b
      config.view.c
    end
    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.configure do |config|
      config.view.delete(:list)
      config.view.a 
      config.view.b
    end
    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

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-5.5.1 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.5.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.4.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.4.0.rc1 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.3.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.0.3 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.1.1 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.2.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.1.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.0.2 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.0.1 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.0.0 spec/views/catalog/_view_type_group.html.erb_spec.rb
blacklight-5.0.0.pre4 spec/views/catalog/_view_type_group.html.erb_spec.rb