Sha256: 5529d6f84ea041529ed8c82bd26ff31de536509c7c06dd7e50ba73e13be3afd5

Contents?: true

Size: 1.73 KB

Versions: 10

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'JavaScript', js: true do
  it 'initializes canvas chart' do
    visit search_catalog_path

    click_button 'Publication Date Sort'
    expect(page).to have_css '.flot-base'
  end
  it 'has a View larger modal' do
    visit search_catalog_path

    click_button 'Publication Date Sort'
    sleep(1) # resize is debounced
    click_link 'View larger »'

    within '.modal-body' do
      expect(page).to have_css '.flot-base'
    end
  end

  context 'when assumed boundaries configured' do
    before do
      CatalogController.blacklight_config.facet_fields['pub_date_si'].range = {
        assumed_boundaries: [1990, 2000]
      }
    end

    after do
      CatalogController.blacklight_config.facet_fields['pub_date_si'].range = true
    end

    it 'should show the range limit with set boundaries' do
      visit '/catalog'
      click_button 'Publication Date Sort'
      expect(page).to have_field :range_pub_date_si_begin, with: '1990'
      expect(page).to have_field :range_pub_date_si_end, with: '2000'
    end
  end

  describe '"Unknown" link' do
    context 'when in the facet (e.g. non-xhr)' do
      it 'is displayed' do
        visit search_catalog_path

        click_button 'Publication Date Sort'

        within 'ul.subsection.missing' do
          expect(page).to have_link 'Unknown'
        end
      end
    end

    context 'when in the modal (e.g. via xhr)' do
      it 'is not displayed' do
        visit search_catalog_path

        click_button 'Publication Date Sort'
        sleep(1) # resize is debounced
        click_link 'View larger »'

        within '.modal-body' do
          expect(page).not_to have_css 'ul.subsection.missing'
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blacklight_range_limit-8.1.0 spec/features/a_javascript_spec.rb
blacklight_range_limit-8.0.1 spec/features/a_javascript_spec.rb
blacklight_range_limit-8.0.0 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.9.1 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.9.0 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.8.2 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.8.1 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.8.0 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.7.0 spec/features/a_javascript_spec.rb
blacklight_range_limit-7.6.0 spec/features/a_javascript_spec.rb