Sha256: 3bcfaa5b368eb4ff0ce7ca3c83b89cbbf4ad2c548b041278d8c8fb89507dde6d

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 KB

Contents

describe 'spotlight/search_configurations/_sort', type: :view do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  before do
    exhibit.blacklight_config.add_sort_field 'sort_title_ssi asc, plus_another_field desc', label: 'TestSort'
    assign(:exhibit, exhibit)
    assign(:blacklight_configuration, exhibit.blacklight_configuration)
    allow(view).to receive_messages(
      current_exhibit: exhibit,
      translate_sort_fields: ''
    )
  end

  let(:f) do
    form_helper = nil
    controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f|
      form_helper = f
    end
    form_helper
  end

  it 'has a disabled relevance sort option' do
    render partial: 'spotlight/search_configurations/sort', locals: { f: f }
    expect(rendered).to have_selector "input[name='blacklight_configuration[sort_fields][relevance][enable]'][disabled='disabled']"
  end

  it 'parameterizes the data-id attribute for sort fields (e.g. when no key is supplied and the sort is used as the key)' do
    render partial: 'spotlight/search_configurations/sort', locals: { f: f }
    expect(rendered).to have_css('[data-id="sort_title_ssi-asc-plus_another_field-desc-id"]')
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
blacklight-spotlight-1.0.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.34.1 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.34.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.33.3 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.33.2 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.33.1 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.33.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.32.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.31.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.30.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.29.1 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb
blacklight-spotlight-0.29.0 spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb