Sha256: 56442db525cbb99e1a42259fb5f8f9542f8f29364629443164ae37de8c391513

Contents?: true

Size: 933 Bytes

Versions: 49

Compression:

Stored size: 933 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Blacklight::StartOverButtonComponent, type: :component do
  subject(:render) { render_inline(instance) }

  let(:instance) { described_class.new }
  let(:blacklight_config) do
    Blacklight::Configuration.new.configure do |config|
      config.view = { list: nil, abc: nil }
    end
  end

  before do
    allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
  end

  context 'with the current view type' do
    before do
      controller.params[:view] = 'abc'
    end

    it 'is the catalog path' do
      expect(render.css('a').first['href']).to eq '/catalog?view=abc'
    end
  end

  context 'when the current view type is the default' do
    before do
      controller.params[:view] = 'list'
    end

    it 'does not include the current view type' do
      expect(render.css('a').first['href']).to eq '/catalog'
    end
  end
end

Version data entries

49 entries across 48 versions & 2 rubygems

Version Path
blacklight-7.34.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta8 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta7 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta6 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta5 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.33.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta4 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta3 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta2 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.0.0.beta1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.33.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.32.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.31.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.30.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.29.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.28.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.27.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.27.0 spec/components/blacklight/start_over_button_component_spec.rb