diff --git a/features/browse_catalogs.feature b/features/browse_catalogs.feature index b228cd2..f27bf11 100644 --- a/features/browse_catalogs.feature +++ b/features/browse_catalogs.feature @@ -150,7 +150,7 @@ Feature: browse catalogs And the "product-description" should be visible @selenium - Scenario: hide description + 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. | @@ -226,6 +226,22 @@ Feature: browse catalogs # And I should see "4.95" within "#product-price-composition" @selenium + Scenario: display inputs and raw materials button when not completely filled + 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 | + | Vitamina | food | + And I am on /catalog/artebonito + And I reload and wait for the page + Then the "#inputs-button" should be visible + And I should see "inputs and raw materials" within "#inputs-button" + + @selenium Scenario: display inputs and raw materials button Given the following product | owner | category | name | price | diff --git a/public/javascripts/catalog.js b/public/javascripts/catalog.js index dcc1395..f7fc4e3 100644 --- a/public/javascripts/catalog.js +++ b/public/javascripts/catalog.js @@ -49,3 +49,12 @@ function click(e) { function hover() { jQuery(this).toggleClass('hover'); } + +jQuery(document).click(function (event) { + if (jQuery(event.target).parents('.expand-box').length == 0) { + jQuery('.expand-box').each(function(index, element){ + jQuery(element).removeClass('open'); + jQuery(element).children('div').toggle(false); + }); + } +}); -- libgit2 0.21.2