Commit 368a90c0682abebed18805995fc319ebafbdfa96
1 parent
9009a9a6
Exists in
master
and in
29 other branches
Catalog fix: close expand boxes when clicking anywhere
Showing
2 changed files
with
26 additions
and
1 deletions
Show diff stats
features/browse_catalogs.feature
... | ... | @@ -150,7 +150,7 @@ Feature: browse catalogs |
150 | 150 | And the "product-description" should be visible |
151 | 151 | |
152 | 152 | @selenium |
153 | - Scenario: hide description | |
153 | + Scenario: hide description | |
154 | 154 | Given the following products |
155 | 155 | | owner | category | name | price | description | |
156 | 156 | | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | |
... | ... | @@ -226,6 +226,22 @@ Feature: browse catalogs |
226 | 226 | # And I should see "4.95" within "#product-price-composition" |
227 | 227 | |
228 | 228 | @selenium |
229 | + Scenario: display inputs and raw materials button when not completely filled | |
230 | + Given the following product | |
231 | + | owner | category | name | price | | |
232 | + | artebonito | food | Vitamina | 17.99 | | |
233 | + And the following unit | |
234 | + | name | plural | | |
235 | + | Liter | Liters | | |
236 | + And the following input | |
237 | + | product | category | | |
238 | + | Vitamina | food | | |
239 | + And I am on /catalog/artebonito | |
240 | + And I reload and wait for the page | |
241 | + Then the "#inputs-button" should be visible | |
242 | + And I should see "inputs and raw materials" within "#inputs-button" | |
243 | + | |
244 | + @selenium | |
229 | 245 | Scenario: display inputs and raw materials button |
230 | 246 | Given the following product |
231 | 247 | | owner | category | name | price | | ... | ... |
public/javascripts/catalog.js
... | ... | @@ -49,3 +49,12 @@ function click(e) { |
49 | 49 | function hover() { |
50 | 50 | jQuery(this).toggleClass('hover'); |
51 | 51 | } |
52 | + | |
53 | +jQuery(document).click(function (event) { | |
54 | + if (jQuery(event.target).parents('.expand-box').length == 0) { | |
55 | + jQuery('.expand-box').each(function(index, element){ | |
56 | + jQuery(element).removeClass('open'); | |
57 | + jQuery(element).children('div').toggle(false); | |
58 | + }); | |
59 | + } | |
60 | +}); | ... | ... |