Commit 9e203e4cc1e3869988ca700d327762a296267478

Authored by Rodrigo Souto
1 parent 300d1dd2

Testing product status is added on the element class

app/views/catalog/index.rhtml
... ... @@ -27,7 +27,7 @@
27 27 <% status << 'not-available' if !product.available %>
28 28 <% status << 'highlighted' if product.highlighted %>
29 29  
30   - <li class="product <%= status.join(' ') %>">
  30 + <li id="product-<%= product.id %>" class="product <%= status.join(' ') %>">
31 31 <ul>
32 32 <li class="product-image-link">
33 33 <% if product.highlighted? %>
... ...
test/functional/catalog_controller_test.rb
... ... @@ -213,4 +213,15 @@ class CatalogControllerTest &lt; ActionController::TestCase
213 213 assert_no_tag :tag => 'div', :attributes => {:id => 'breadcrumb'}, :descendant => {:tag => 'a', :attributes => {:href => /level=#{pc3.id}/}}
214 214 end
215 215  
  216 + should 'add product status on the class css' do
  217 + category = ProductCategory.create!(:name => "Cateogry", :environment => @enterprise.environment)
  218 + p1 = fast_create(Product, :product_category_id => category.id, :enterprise_id => @enterprise.id, :highlighted => true)
  219 + p2 = fast_create(Product, :product_category_id => category.id, :enterprise_id => @enterprise.id, :available => false)
  220 +
  221 + get :index, :profile => @enterprise.identifier
  222 +
  223 + assert_tag :tag => 'li', :attributes => {:id => "product-#{p1.id}", :class => /highlighted/}
  224 + assert_tag :tag => 'li', :attributes => {:id => "product-#{p2.id}", :class => /not-available/}
  225 + end
  226 +
216 227 end
... ...