diff --git a/app/views/catalog/index.rhtml b/app/views/catalog/index.rhtml index 080c471..92db4bf 100644 --- a/app/views/catalog/index.rhtml +++ b/app/views/catalog/index.rhtml @@ -62,13 +62,14 @@ <% end %> - <% if product.any_inputs_details? %> + <% if product.inputs.count > 0 %>
  • <%= _('inputs and raw materials') %>
    <% product.inputs.each do |i| %> -
    <%= "#{i.amount_used} #{i.unit.singular} #{_('of')} #{i.product_category.name}" if i.has_all_price_details? %>
    +
    <%= "#{i.amount_used} #{i.unit.singular} #{_('of')} " if i.has_all_price_details? %> + <%= "#{i.product_category.name}" %>
    <% end %>
  • diff --git a/features/browse_catalogs.feature b/features/browse_catalogs.feature index e477ef4..b228cd2 100644 --- a/features/browse_catalogs.feature +++ b/features/browse_catalogs.feature @@ -149,6 +149,19 @@ Feature: browse catalogs Then I should see "A small description" within "#product-description" And the "product-description" should be visible + @selenium + Scenario: hide description + Given the following products + | owner | category | name | price | description | + | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | + And I am on /catalog/artebonito + And I reload and wait for the page + When I click "product-description-button" + Then I should see "A small description" within "#product-description" + And the "product-description" should be visible + When I click "product-description-button" + Then the "product-description" should not be visible + Scenario: display unavailable product Given the following products | owner | category | name | price | available | @@ -248,3 +261,22 @@ Feature: browse catalogs When I click "#inputs-button" Then the "#inputs-description" should be visible And I should see "7.0 Liter of food" within "#inputs-description" + + @selenium + Scenario: hide inputs and raw materials + Given the following product + | owner | category | name | price | + | artebonito | food | Vitamina | 17.99 | + And the following unit + | name | plural | + | Liter | Liters | + And the following input + | product | category | price_per_unit | amount_used | unit | + | Vitamina | food | 1.45 | 7 | Liter | + And I am on /catalog/artebonito + And I reload and wait for the page + When I click "#inputs-button" + Then the "#inputs-description" should be visible + And I should see "7.0 Liter of food" within "#inputs-description" + When I click "#inputs-button" + Then the "#inputs-description" should not be visible -- libgit2 0.21.2