Commit 0d33fd94abb596117a38fc30516c7604230cc2ed
1 parent
424b795e
Exists in
master
and in
23 other branches
Fixed a problem with inputs expand-box on catalog
* The inputs expand-box must appear even if the inputs are not completely filled.
Showing
2 changed files
with
35 additions
and
2 deletions
Show diff stats
app/views/catalog/index.rhtml
| ... | ... | @@ -62,13 +62,14 @@ |
| 62 | 62 | </li> |
| 63 | 63 | <% end %> |
| 64 | 64 | |
| 65 | - <% if product.any_inputs_details? %> | |
| 65 | + <% if product.inputs.count > 0 %> | |
| 66 | 66 | <li class="product-inputs expand-box"> |
| 67 | 67 | <span id="inputs-button"><%= _('inputs and raw materials') %></span> |
| 68 | 68 | <div class="arrow"></div> |
| 69 | 69 | <div class="content" id="inputs-description"> |
| 70 | 70 | <% product.inputs.each do |i| %> |
| 71 | - <div><%= "#{i.amount_used} #{i.unit.singular} #{_('of')} #{i.product_category.name}" if i.has_all_price_details? %></div> | |
| 71 | + <div><%= "#{i.amount_used} #{i.unit.singular} #{_('of')} " if i.has_all_price_details? %> | |
| 72 | + <%= "#{i.product_category.name}" %></div> | |
| 72 | 73 | <% end %> |
| 73 | 74 | </div> |
| 74 | 75 | </li> | ... | ... |
features/browse_catalogs.feature
| ... | ... | @@ -149,6 +149,19 @@ Feature: browse catalogs |
| 149 | 149 | Then I should see "A small description" within "#product-description" |
| 150 | 150 | And the "product-description" should be visible |
| 151 | 151 | |
| 152 | + @selenium | |
| 153 | + Scenario: hide description | |
| 154 | + Given the following products | |
| 155 | + | owner | category | name | price | description | | |
| 156 | + | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | | |
| 157 | + And I am on /catalog/artebonito | |
| 158 | + And I reload and wait for the page | |
| 159 | + When I click "product-description-button" | |
| 160 | + Then I should see "A small description" within "#product-description" | |
| 161 | + And the "product-description" should be visible | |
| 162 | + When I click "product-description-button" | |
| 163 | + Then the "product-description" should not be visible | |
| 164 | + | |
| 152 | 165 | Scenario: display unavailable product |
| 153 | 166 | Given the following products |
| 154 | 167 | | owner | category | name | price | available | |
| ... | ... | @@ -248,3 +261,22 @@ Feature: browse catalogs |
| 248 | 261 | When I click "#inputs-button" |
| 249 | 262 | Then the "#inputs-description" should be visible |
| 250 | 263 | And I should see "7.0 Liter of food" within "#inputs-description" |
| 264 | + | |
| 265 | + @selenium | |
| 266 | + Scenario: hide inputs and raw materials | |
| 267 | + Given the following product | |
| 268 | + | owner | category | name | price | | |
| 269 | + | artebonito | food | Vitamina | 17.99 | | |
| 270 | + And the following unit | |
| 271 | + | name | plural | | |
| 272 | + | Liter | Liters | | |
| 273 | + And the following input | |
| 274 | + | product | category | price_per_unit | amount_used | unit | | |
| 275 | + | Vitamina | food | 1.45 | 7 | Liter | | |
| 276 | + And I am on /catalog/artebonito | |
| 277 | + And I reload and wait for the page | |
| 278 | + When I click "#inputs-button" | |
| 279 | + Then the "#inputs-description" should be visible | |
| 280 | + And I should see "7.0 Liter of food" within "#inputs-description" | |
| 281 | + When I click "#inputs-button" | |
| 282 | + Then the "#inputs-description" should not be visible | ... | ... |