Skip to content

Commit

Permalink
Allow pagination of product search results.
Browse files Browse the repository at this point in the history
[Fixes #1539]
  • Loading branch information
JDutil authored and radar committed May 29, 2012
1 parent 2bbe70a commit a84b5fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion core/app/views/spree/shared/_products.html.erb
Expand Up @@ -26,6 +26,5 @@
<% end %> <% end %>
<% if paginated_products.respond_to?(:num_pages) <% if paginated_products.respond_to?(:num_pages)
params.delete(:search)
params.delete(:taxon) params.delete(:taxon)
%><%= paginate paginated_products %><% end %> %><%= paginate paginated_products %><% end %>
16 changes: 16 additions & 0 deletions core/spec/requests/products_spec.rb
Expand Up @@ -106,6 +106,22 @@
tmp.sort!.should == ["Ruby on Rails Ringer T-Shirt", "Ruby on Rails Stein", "Ruby on Rails Tote"] tmp.sort!.should == ["Ruby on Rails Ringer T-Shirt", "Ruby on Rails Stein", "Ruby on Rails Tote"]
end end


it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
Spree::Config.products_per_page = 2
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
check "Price_Range_$15.00_-_$18.00"
within(:css, '#sidebar_products_search') { click_button "Search" }

page.all('ul.product-listing li').size.should == 2
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
tmp.sort!.should == ["Ruby on Rails Ringer T-Shirt", "Ruby on Rails Tote"]
find('nav.pagination .next a').click
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
tmp.delete("")
tmp.sort!.should == ["Ruby on Rails Stein"]
end

it "should be able to display products priced 18 dollars and above" do it "should be able to display products priced 18 dollars and above" do
within(:css, '#taxonomies') { click_link "Ruby on Rails" } within(:css, '#taxonomies') { click_link "Ruby on Rails" }
check "Price_Range_$18.00_-_$20.00" check "Price_Range_$18.00_-_$20.00"
Expand Down

0 comments on commit a84b5fd

Please sign in to comment.