Sha256: 935dc72760ad6f86723f38ecb4c9c6ff19ad7d9aaa1af0b40252052f3157e208

Contents?: true

Size: 1018 Bytes

Versions: 56

Compression:

Stored size: 1018 Bytes

Contents

describe 'spotlight/search_configurations/_facet_metadata', type: :view do
  before do
    render partial: 'spotlight/search_configurations/facet_metadata', locals: { metadata: metadata }
  end

  context 'with a facet without any documents' do
    let(:metadata) { { document_count: 0 } }

    it 'shows there are no documents' do
      expect(rendered).to have_content '0 items'
    end
  end

  context 'with a facet with a small number of values' do
    let(:metadata) { { document_count: 1, value_count: 3, terms: %w(a b c) } }

    it 'shows the number of unique values' do
      expect(rendered).to have_content '1 item'
      expect(rendered).to have_content '3 unique values'
      expect(rendered).to have_selector '.btn-with-tooltip'
    end
  end

  context 'with a facet with a large number of values' do
    let(:metadata) { { document_count: 1, value_count: 21, terms: %w() } }

    it 'shows there are many unique values' do
      expect(rendered).to have_content '20+ unique values'
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
blacklight-spotlight-1.4.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.3.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.2.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.1.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.0.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.34.1 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.34.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.33.3 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.33.2 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.33.1 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.33.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.32.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.31.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.30.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.29.1 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.29.0 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.28.3 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb
blacklight-spotlight-0.28.2 spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb