Sha256: 8ea8a64f4fb792e07c36fb14017ca758aa5bf17fabe58a4fc613084a7cc315be

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

# -*- encoding : utf-8 -*-

require 'spec_helper'

describe "Search Results context", js: true do
  it "should pass the current search id through" do
    search_for ''
    search_id =  Search.last.id.to_s
    click_on 'Pluvial nectar of blessings'
    expect(page).to have_content "« Previous | 10 of 30 | Next »"
    prev = page.find("#previousNextDocument .previous")
    expect(prev['data-context-href']).to eq "/catalog/2003546302/track?counter=9&search_id=#{search_id}"

    click_on "« Previous"

    prev = page.find("#previousNextDocument .previous")
    expect(prev['data-context-href']).to eq "/catalog/2004310986/track?counter=8&search_id=#{search_id}"
  end
  
  it "should redirect context urls to the original url" do
    search_for ''
    first('.index_title a').click
    expect(page).to have_content "« Previous | 1 of 30 | Next »"
    expect(page.current_url).to_not have_content "/track"
  end
  
  context "navigating between search results using context pagination" do
    it "should update the back to search link with the current search pagination context" do
      search_for ''
      first('.index_title a').click
      10.times do
        click_on "Next »"
      end
      
      click_on "Back to Search"
      expect(page).to have_content "11 - 20"
    end
  end
end


def search_for q
  visit root_path
  fill_in "q", with: q
  click_button 'search'
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
blacklight-5.8.2 spec/features/search_context_spec.rb
blacklight-5.8.1 spec/features/search_context_spec.rb
blacklight-5.8.0 spec/features/search_context_spec.rb
blacklight-5.7.2 spec/features/search_context_spec.rb
blacklight-5.5.4 spec/features/search_context_spec.rb
blacklight-5.7.1 spec/features/search_context_spec.rb
blacklight-5.7.0 spec/features/search_context_spec.rb
blacklight-5.6.0 spec/features/search_context_spec.rb
blacklight-5.5.3 spec/features/search_context_spec.rb
blacklight-5.5.2 spec/features/search_context_spec.rb
blacklight-5.5.1 spec/features/search_context_spec.rb
blacklight-5.5.0 spec/features/search_context_spec.rb
blacklight-5.4.0 spec/features/search_context_spec.rb
blacklight-5.4.0.rc1 spec/features/search_context_spec.rb
blacklight-5.3.0 spec/features/search_context_spec.rb