Commit c635810b8e3d62ea8b39412677bd1257bd91ec83
Committed by
Rafael Martins
1 parent
c11ada20
Exists in
master
and in
29 other branches
Some fixes on redesigned Catalog
(ActionItem2111)
Showing
17 changed files
with
193 additions
and
329 deletions
Show diff stats
app/views/catalog/_index.rhtml
app/views/catalog/index.rhtml
... | ... | @@ -37,26 +37,22 @@ |
37 | 37 | <% if product.description %> |
38 | 38 | <li class="product-description expand-box"> |
39 | 39 | <span id="product-description-button"><%= _('description') %></span> |
40 | - <div> | |
41 | - <div class="arrow"></div> | |
42 | - <div class="content" id="product-description"><%= txt2html(product.description || '') %></div> | |
43 | - </div> | |
40 | + <div class="arrow"></div> | |
41 | + <div class="content" id="product-description"><%= txt2html(product.description || '') %></div> | |
44 | 42 | </li> |
45 | 43 | <% end %> |
46 | 44 | |
47 | 45 | <% if product.is_open_price? %> |
48 | 46 | <li class="product-price-composition expand-box"> |
49 | 47 | <span id="product-price-composition-button"><%= _('price composition') %></span> |
50 | - <div> | |
51 | - <div class="arrow"></div> | |
52 | - <div class="content" id="product-price-composition"> | |
53 | - <% product.inputs.each do |i| %> | |
54 | - <div class="search-product-input-dots-to-price"> | |
55 | - <div class="search-product-input-name"><%= i.product_category.name %></div> | |
56 | - <%= price_span i.price_per_unit * i.amount_used, :class => 'search-product-input-price' %> | |
57 | - </div> | |
58 | - <% end %> | |
59 | - </div> | |
48 | + <div class="arrow"></div> | |
49 | + <div class="content" id="product-price-composition"> | |
50 | + <% product.inputs.each do |i| %> | |
51 | + <div class="search-product-input-dots-to-price"> | |
52 | + <div class="search-product-input-name"><%= i.product_category.name %></div> | |
53 | + <%= price_span i.price_per_unit * i.amount_used, :class => 'search-product-input-price' %> | |
54 | + </div> | |
55 | + <% end %> | |
60 | 56 | </div> |
61 | 57 | </li> |
62 | 58 | <% end %> |
... | ... | @@ -64,13 +60,11 @@ |
64 | 60 | <% if product.any_inputs_details? %> |
65 | 61 | <li class="product-inputs expand-box"> |
66 | 62 | <span id="inputs-button"><%= _('inputs and raw materials') %></span> |
67 | - <div> | |
68 | - <div class="arrow"></div> | |
69 | - <div class="content" id="inputs-description"> | |
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> | |
72 | - <% end %> | |
73 | - </div> | |
63 | + <div class="arrow"></div> | |
64 | + <div class="content" id="inputs-description"> | |
65 | + <% product.inputs.each do |i| %> | |
66 | + <div><%= "#{i.amount_used} #{i.unit.singular} #{_('of')} #{i.product_category.name}" if i.has_all_price_details? %></div> | |
67 | + <% end %> | |
74 | 68 | </div> |
75 | 69 | </li> |
76 | 70 | <% end %> |
... | ... | @@ -81,10 +75,6 @@ |
81 | 75 | <div><%= render :partial => 'shared/product/qualifiers', :locals => {:product => product} %></div> |
82 | 76 | <% end %> |
83 | 77 | |
84 | - <li class="product-category"> | |
85 | - <%# profile.enabled? ? link_to_product_category(product.product_category) : (product.product_category ? product.product_category.full_name(' → ') : _('Uncategorized product')) %> | |
86 | - </li> | |
87 | - | |
88 | 78 | <% extra_content_list.map do |content| %> |
89 | 79 | <li><%= content %></li> |
90 | 80 | <% end %> |
... | ... | @@ -98,4 +88,3 @@ |
98 | 88 | </ul> |
99 | 89 | |
100 | 90 | <%= pagination_links @products, :params => {:controller => :catalog, :action => :index, :profile => profile.identifier} %> |
101 | - | ... | ... |
app/views/content_viewer/_enterprise_homepage.rhtml
1 | 1 | <%= display_profile_info enterprise_homepage.profile %> |
2 | 2 | <div><%= enterprise_homepage.body %></div> |
3 | -<%= render :partial => 'catalog/index' unless enterprise_homepage.profile.environment.enabled?('disable_products_for_enterprises') %> | |
3 | +<%= render :file => 'catalog/index' unless enterprise_homepage.profile.environment.enabled?('disable_products_for_enterprises') %> | ... | ... |
app/views/layouts/_javascript.rhtml
1 | -<%= javascript_include_tag :defaults, 'jquery-latest.js', 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery.cookie', 'reflection', 'add-and-join', 'jquery.tokeninput', 'report-abuse','colorbox', 'jquery-validation/jquery.validate', :cache => 'cache-general' %> | |
1 | +<%= javascript_include_tag :defaults, 'jquery-latest.js', 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery.cookie', 'reflection', 'add-and-join', 'jquery.tokeninput', 'report-abuse','colorbox', 'jquery-validation/jquery.validate', 'catalog', :cache => 'cache-general' %> | |
2 | + | |
2 | 3 | <% language = FastGettext.locale %> |
3 | 4 | <%= javascript_include_tag 'jquery-validation/localization/messages_'+language, 'jquery-validation/localization/methods_'+language %> | ... | ... |
features/browse_catalogs.feature
... | ... | @@ -14,16 +14,16 @@ Feature: browse catalogs |
14 | 14 | | name | |
15 | 15 | | categ1 | |
16 | 16 | | food | |
17 | + And I am on /catalog/artebonito | |
17 | 18 | |
18 | 19 | Scenario: display titles |
19 | - Given I am on /catalog/artebonito | |
20 | 20 | Then I should see "Associação de Artesanato de Bonito" |
21 | 21 | And I should see "Products/Services" within "#product-list" |
22 | 22 | |
23 | 23 | Scenario: display the simplest possible product |
24 | - Given the following simple products | |
25 | - | owner | category | | |
26 | - | artebonito | categ1 | | |
24 | + Given the following products | |
25 | + | owner | category | | |
26 | + | artebonito | categ1 | | |
27 | 27 | And I am on /catalog/artebonito |
28 | 28 | Then I should see "categ1" within "li.product-link" |
29 | 29 | And I should see "No image" within "li.product-big" |
... | ... | @@ -34,8 +34,8 @@ Feature: browse catalogs |
34 | 34 | And I should not see "price composition" |
35 | 35 | |
36 | 36 | Scenario: display a simple product without price |
37 | - Given the following simple products | |
38 | - | owner | category | name | | |
37 | + Given the following products | |
38 | + | owner | category | name | | |
39 | 39 | | artebonito | categ1 | Produto1 | |
40 | 40 | And I am on /catalog/artebonito |
41 | 41 | Then I should see "Produto1" within "li.product-link" |
... | ... | @@ -47,8 +47,8 @@ Feature: browse catalogs |
47 | 47 | And I should not see "price composition" |
48 | 48 | |
49 | 49 | Scenario: display a simple product without details |
50 | - Given the following simple products | |
51 | - | owner | category | name | price | | |
50 | + Given the following products | |
51 | + | owner | category | name | price | | |
52 | 52 | | artebonito | categ1 | Produto1 | 50.00 | |
53 | 53 | And I am on /catalog/artebonito |
54 | 54 | Then I should see "Produto1" within "li.product-link" |
... | ... | @@ -60,19 +60,17 @@ Feature: browse catalogs |
60 | 60 | And I should not see "qualifiers" |
61 | 61 | And I should not see "price composition" |
62 | 62 | |
63 | -#FIXME: test different units | |
64 | - | |
65 | 63 | Scenario: product name links to product page |
66 | - Given the following simple products | |
67 | - | owner | category | name | price | | |
64 | + Given the following products | |
65 | + | owner | category | name | price | | |
68 | 66 | | artebonito | categ1 | Produto1 | 50.00 | |
69 | 67 | And I am on /catalog/artebonito |
70 | 68 | When I follow "Produto1" within "li.product-link" |
71 | 69 | Then I should be taken to "Produto1" product page |
72 | 70 | |
73 | 71 | Scenario: display product with custom image |
74 | - Given the following simple products | |
75 | - | owner | category | name | price | img | | |
72 | + Given the following products | |
73 | + | owner | category | name | price | img | | |
76 | 74 | | artebonito | categ1 | Agrotox | 12.34 | agrotox | |
77 | 75 | And I am on /catalog/artebonito |
78 | 76 | Then I should see "Agrotox" within "li.product-link" |
... | ... | @@ -85,16 +83,16 @@ Feature: browse catalogs |
85 | 83 | And I should not see "price composition" |
86 | 84 | |
87 | 85 | Scenario: image links to product page |
88 | - Given the following simple products | |
89 | - | owner | category | name | price | img | | |
86 | + Given the following products | |
87 | + | owner | category | name | price | img | | |
90 | 88 | | artebonito | categ1 | Agrotox | 12.34 | agrotox | |
91 | 89 | And I am on /catalog/artebonito |
92 | 90 | When I follow "Agrotox" within "#product-image-link" |
93 | 91 | Then I should be taken to "Agrotox" product page |
94 | 92 | |
95 | 93 | Scenario: display product with discount |
96 | - Given the following simple products | |
97 | - | owner | category | name | price | discount | img | | |
94 | + Given the following products | |
95 | + | owner | category | name | price | discount | img | | |
98 | 96 | | artebonito | categ1 | Semterrinha | 99.99 | 12.34 | semterrinha | |
99 | 97 | And I am on /catalog/artebonito |
100 | 98 | Then I should see "Semterrinha" within "li.product-link" |
... | ... | @@ -107,23 +105,22 @@ Feature: browse catalogs |
107 | 105 | |
108 | 106 | @selenium |
109 | 107 | Scenario: display description button when needed (but not the description) |
110 | - Given the following simple products | |
111 | - | owner | category | name | price | description | | |
112 | - | artebonito | categ1 | Produto2 | 12.34 | A small description for a product that doesn't exist. | | |
108 | + Given the following products | |
109 | + | owner | category | name | price | description | | |
110 | + | artebonito | categ1 | Produto2 | 12.34 | A small description for a product that doesn't exist. | | |
113 | 111 | And I am on /catalog/artebonito |
114 | 112 | Then I should see "Produto2" within "li.product-link" |
115 | 113 | And I should see "12.34" within "span.product-price" |
116 | 114 | And I should see "description" within "#product-description-button" |
117 | 115 | And the "product-description-button" should be visible |
118 | -# Doesn't make a lot of sense, but I have to check the text and the visibility separately | |
119 | 116 | And I should see "A small description" within "#product-description" |
120 | 117 | And the "product-description" should not be visible |
121 | 118 | |
122 | 119 | @selenium |
123 | 120 | Scenario: display description when button is clicked |
124 | - Given the following simple products | |
125 | - | owner | category | name | price | description | | |
126 | - | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | | |
121 | + Given the following products | |
122 | + | owner | category | name | price | description | | |
123 | + | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | | |
127 | 124 | And I am on /catalog/artebonito |
128 | 125 | And I reload and wait for the page |
129 | 126 | When I click "product-description-button" |
... | ... | @@ -131,8 +128,8 @@ Feature: browse catalogs |
131 | 128 | And the "product-description" should be visible |
132 | 129 | |
133 | 130 | Scenario: display unavailable product |
134 | - Given the following simple products | |
135 | - | owner | category | name | price | available | | |
131 | + Given the following products | |
132 | + | owner | category | name | price | available | | |
136 | 133 | | artebonito | categ1 | Prod3 | 12.34 | false | |
137 | 134 | And I am on /catalog/artebonito |
138 | 135 | Then I should see "Prod3" within "li.not-available" |
... | ... | @@ -148,8 +145,8 @@ Feature: browse catalogs |
148 | 145 | And the following certifiers |
149 | 146 | | name | qualifiers | |
150 | 147 | | Colivre | Organic | |
151 | - And the following simple products | |
152 | - | owner | category | name | price | qualifier | | |
148 | + And the following products | |
149 | + | owner | category | name | price | qualifier | | |
153 | 150 | | artebonito | categ1 | Banana | 0.99 | Organic | |
154 | 151 | And I am on /catalog/artebonito |
155 | 152 | Then I should see "Banana" within "li.product-link" |
... | ... | @@ -161,9 +158,9 @@ Feature: browse catalogs |
161 | 158 | #FIXME: this will only be available after AI1413 |
162 | 159 | # @selenium |
163 | 160 | # Scenario: display price composition button (but not inputs) |
164 | -# Given the following simple product | |
165 | -# | owner | category | name | price | | |
166 | -# | artebonito | food | Bananada | 10.00 | | |
161 | +# Given the following product | |
162 | +# | owner | category | name | price | | |
163 | +# | artebonito | food | Bananada | 10.00 | | |
167 | 164 | # And the following input |
168 | 165 | # | product | category | price_per_unit | amount_used | |
169 | 166 | # | Bananada | food | 0.99 | 5 | |
... | ... | @@ -180,9 +177,9 @@ Feature: browse catalogs |
180 | 177 | #FIXME: this will only be available after AI1413 |
181 | 178 | # @selenium |
182 | 179 | # Scenario: display price composition when button is clicked |
183 | -# Given the following simple product | |
184 | -# | owner | category | name | price | | |
185 | -# | artebonito | food | Bananada | 10.00 | | |
180 | +# Given the following product | |
181 | +# | owner | category | name | price | | |
182 | +# | artebonito | food | Bananada | 10.00 | | |
186 | 183 | # And the following input |
187 | 184 | # | product | category | price_per_unit | amount_used | |
188 | 185 | # | Bananada | food | 0.99 | 5 | |
... | ... | @@ -195,14 +192,14 @@ Feature: browse catalogs |
195 | 192 | |
196 | 193 | @selenium |
197 | 194 | Scenario: display inputs and raw materials button |
198 | - Given the following simple product | |
199 | - | owner | category | name | price | | |
200 | - | artebonito | food | Vitamina | 17.99 | | |
195 | + Given the following product | |
196 | + | owner | category | name | price | | |
197 | + | artebonito | food | Vitamina | 17.99 | | |
201 | 198 | And the following unit |
202 | 199 | | name | plural | |
203 | 200 | | Liter | Liters | |
204 | 201 | And the following input |
205 | - | product | category | price_per_unit | amount_used | unit | | |
202 | + | product | category | price_per_unit | amount_used | unit | | |
206 | 203 | | Vitamina | food | 1.45 | 7 | Liter | |
207 | 204 | And I am on /catalog/artebonito |
208 | 205 | And I reload and wait for the page |
... | ... | @@ -215,25 +212,17 @@ Feature: browse catalogs |
215 | 212 | |
216 | 213 | @selenium |
217 | 214 | Scenario: display inputs and raw materials description |
218 | - Given the following simple product | |
219 | - | owner | category | name | price | | |
220 | - | artebonito | food | Vitamina | 17.99 | | |
215 | + Given the following product | |
216 | + | owner | category | name | price | | |
217 | + | artebonito | food | Vitamina | 17.99 | | |
221 | 218 | And the following unit |
222 | 219 | | name | plural | |
223 | 220 | | Liter | Liters | |
224 | 221 | And the following input |
225 | - | product | category | price_per_unit | amount_used | unit | | |
222 | + | product | category | price_per_unit | amount_used | unit | | |
226 | 223 | | Vitamina | food | 1.45 | 7 | Liter | |
227 | 224 | And I am on /catalog/artebonito |
228 | 225 | And I reload and wait for the page |
229 | 226 | When I click "#inputs-button" |
230 | 227 | Then the "#inputs-description" should be visible |
231 | 228 | And I should see "7.0 Liter of food" within "#inputs-description" |
232 | - | |
233 | -#FIXME: pagination tests are on manage_products featuRe | |
234 | -#FIXME: check unit and functional tests for possible wrong-placed 'features | |
235 | -#FIXME: test unavailable product with more details | |
236 | -#FIXME: test more than one qualifier | |
237 | -#FIXME: put And I am on /catalog/artebonito on the Background | |
238 | -#FIXME: test more than one input and different units | |
239 | -#FIXME: test the product order | ... | ... |
features/browse_enterprises.feature
... | ... | @@ -14,15 +14,14 @@ Scenario: show all enterprises |
14 | 14 | | identifier | name | |
15 | 15 | | shop2 | Fruits Shop | |
16 | 16 | Given I am on /assets/enterprises |
17 | - Then I should see "Enterprises" | |
17 | + Then I should see "Enterprises" | |
18 | 18 | And I should see "Shoes Shop" |
19 | 19 | And I should see "Fruits Shop" |
20 | 20 | |
21 | 21 | Scenario: show profile links button |
22 | 22 | Given I am on /assets/enterprises |
23 | 23 | Then I should see "Profile links" within "a.enterprise-trigger" |
24 | -# And I should not see "Products" | |
25 | - And I should not see "Members" | |
24 | + And I should not see "Members" | |
26 | 25 | And I should not see "Agenda" |
27 | 26 | |
28 | 27 | @selenium |
... | ... | @@ -37,8 +36,5 @@ Scenario: show profile links when clicked |
37 | 36 | Scenario: go to catalog when click on products link |
38 | 37 | Given I am on /assets/enterprises |
39 | 38 | When I follow "Profile links" |
40 | -# And I follow "Products" within "ul.menu-submenu-list" | |
41 | -# FIXME: 'Products' is a common link, may end up following the wrong one | |
42 | 39 | And I follow "Products" and wait |
43 | 40 | Then I should be exactly on /catalog/shop1 |
44 | - | ... | ... |
features/comment.feature
... | ... | @@ -24,16 +24,15 @@ Feature: comment |
24 | 24 | When I press "Post comment" |
25 | 25 | Then I should not see "Hey ho, let's go" |
26 | 26 | |
27 | -# This fails because of the captcha | |
28 | -# @selenium | |
29 | -# Scenario: post a comment while not authenticated | |
30 | -# Given I am on /booking/article-to-comment | |
31 | -# And I fill in "Name" with "Joey Ramone" | |
32 | -# And I fill in "e-mail" with "joey@ramones.com" | |
33 | -# And I fill in "Title" with "Hey ho, let's go!" | |
34 | -# And I fill in "Enter your comment" with "Hey ho, let's go!" | |
35 | -# When I press "Post comment" | |
36 | -# Then I should see "Hey ho, let's go" | |
27 | + @selenium | |
28 | + Scenario: post a comment while not authenticated | |
29 | + Given I am on /booking/article-to-comment | |
30 | + And I fill in "Name" with "Joey Ramone" | |
31 | + And I fill in "e-mail" with "joey@ramones.com" | |
32 | + And I fill in "Title" with "Hey ho, let's go!" | |
33 | + And I fill in "Enter your comment" with "Hey ho, let's go!" | |
34 | + When I press "Post comment" | |
35 | + Then I should see "Hey ho, let's go" | |
37 | 36 | |
38 | 37 | @selenium |
39 | 38 | Scenario: post comment while authenticated |
... | ... | @@ -56,26 +55,24 @@ Feature: comment |
56 | 55 | When I press "Post comment" |
57 | 56 | Then I should be exactly on /booking/rails.png?view=true |
58 | 57 | |
59 | -#FIXME: only one error comes up at a time, not both | |
60 | -# @selenium | |
61 | -# Scenario: show error messages when make a blank comment | |
62 | -# Given I am logged in as "booking" | |
63 | -# And I am on /booking/article-to-comment | |
64 | -# When I press "Post comment" | |
65 | -# Then I should see "Title can't be blank" | |
66 | -# And I should see "Body can't be blank" | |
58 | + @selenium | |
59 | + Scenario: show error messages when make a blank comment | |
60 | + Given I am logged in as "booking" | |
61 | + And I am on /booking/article-to-comment | |
62 | + When I press "Post comment" | |
63 | + Then I should see "Title can't be blank" | |
64 | + And I should see "Body can't be blank" | |
67 | 65 | |
68 | -#FIXME: fails because of the captcha | |
69 | -# @selenium | |
70 | -# Scenario: disable post comment button | |
71 | -# Given I am on /booking/article-to-comment | |
72 | -# And I fill in "Name" with "Joey Ramone" | |
73 | -# And I fill in "e-mail" with "joey@ramones.com" | |
74 | -# And I fill in "Title" with "Hey ho, let's go!" | |
75 | -# And I fill in "Enter your comment" with "Hey ho, let's go!" | |
76 | -# When I press "Post comment" | |
77 | -# Then the "value.Post comment" button should not be enabled | |
78 | -# And I should see "Hey ho, let's go" | |
66 | + @selenium | |
67 | + Scenario: disable post comment button | |
68 | + Given I am on /booking/article-to-comment | |
69 | + And I fill in "Name" with "Joey Ramone" | |
70 | + And I fill in "e-mail" with "joey@ramones.com" | |
71 | + And I fill in "Title" with "Hey ho, let's go!" | |
72 | + And I fill in "Enter your comment" with "Hey ho, let's go!" | |
73 | + When I press "Post comment" | |
74 | + Then the "value.Post comment" button should not be enabled | |
75 | + And I should see "Hey ho, let's go" | |
79 | 76 | |
80 | 77 | @selenium |
81 | 78 | Scenario: render comment form and go to bottom |
... | ... | @@ -85,11 +82,10 @@ Feature: comment |
85 | 82 | And I should be exactly on /booking/article-with-comment |
86 | 83 | And I should be moved to anchor "comment_form" |
87 | 84 | |
88 | -#FIXME: fails because of the captcha | |
89 | -# @selenium | |
90 | -# Scenario: keep comments field filled while trying to do a comment | |
91 | -# Given I am on /booking/article-with-comment | |
92 | -# And I fill in "Name" with "Joey Ramone" | |
93 | -# When I press "Post comment" | |
94 | -# Then the "Name" field should contain "Joey Ramone" | |
95 | -# And I should see "errors prohibited" | |
85 | + @selenium | |
86 | + Scenario: keep comments field filled while trying to do a comment | |
87 | + Given I am on /booking/article-with-comment | |
88 | + And I fill in "Name" with "Joey Ramone" | |
89 | + When I press "Post comment" | |
90 | + Then the "Name" field should contain "Joey Ramone" | |
91 | + And I should see "errors prohibited" | ... | ... |
features/comment_reply.feature
... | ... | @@ -25,15 +25,14 @@ Feature: comment |
25 | 25 | Then I should not see "Enter your comment" within "div.comment-balloon" |
26 | 26 | And I should see "Reply" within "div.comment-balloon" |
27 | 27 | |
28 | -#FIXME: fails because only one error message comes up at a time | |
29 | -# @selenium | |
30 | -# Scenario: show error messages when make a blank comment reply | |
31 | -# Given I am logged in as "booking" | |
32 | -# And I go to /booking/article-to-comment | |
33 | -# And I follow "Reply" within ".comment-balloon" | |
34 | -# When I press "Post comment" within ".comment-balloon" | |
35 | -# Then I should see "Title can't be blank" within "div.comment_reply" | |
36 | -# And I should see "Body can't be blank" within "div.comment_reply" | |
28 | + @selenium | |
29 | + Scenario: show error messages when make a blank comment reply | |
30 | + Given I am logged in as "booking" | |
31 | + And I go to /booking/article-to-comment | |
32 | + And I follow "Reply" within ".comment-balloon" | |
33 | + When I press "Post comment" within ".comment-balloon" | |
34 | + Then I should see "Title can't be blank" within "div.comment_reply" | |
35 | + And I should see "Body can't be blank" within "div.comment_reply" | |
37 | 36 | |
38 | 37 | @selenium |
39 | 38 | Scenario: not show any reply form by default |
... | ... | @@ -63,32 +62,30 @@ Feature: comment |
63 | 62 | Then there should be 1 "comment_form" within "comment_reply" |
64 | 63 | And I should see "Enter your comment" within "div.comment_reply.opened" |
65 | 64 | |
66 | -#FIXME: fails because of the captcha | |
67 | -# @selenium | |
68 | -# Scenario: reply a comment | |
69 | -# Given I go to /booking/another-article | |
70 | -# And I follow "Reply" within ".comment-balloon" | |
71 | -# And I fill in "Name" within "comment-balloon" with "Joey" | |
72 | -# And I fill in "e-mail" within "comment-balloon" with "joey@ramones.com" | |
73 | -# And I fill in "Title" within "comment-balloon" with "Hey ho, let's go!" | |
74 | -# And I fill in "Enter your comment" within "comment-balloon" with "Hey ho, let's go!" | |
75 | -# When I press "Post comment" within ".comment-balloon" | |
76 | -# Then I should see "Hey ho, let's go" within "ul.comment-replies" | |
77 | -# And there should be 1 "comment-replies" within "article-comment" | |
65 | + @selenium | |
66 | + Scenario: reply a comment | |
67 | + Given I go to /booking/another-article | |
68 | + And I follow "Reply" within ".comment-balloon" | |
69 | + And I fill in "Name" within "comment-balloon" with "Joey" | |
70 | + And I fill in "e-mail" within "comment-balloon" with "joey@ramones.com" | |
71 | + And I fill in "Title" within "comment-balloon" with "Hey ho, let's go!" | |
72 | + And I fill in "Enter your comment" within "comment-balloon" with "Hey ho, let's go!" | |
73 | + When I press "Post comment" within ".comment-balloon" | |
74 | + Then I should see "Hey ho, let's go" within "ul.comment-replies" | |
75 | + And there should be 1 "comment-replies" within "article-comment" | |
78 | 76 | |
79 | -#FIXME: fails because of the captcha | |
80 | -# @selenium | |
81 | -# Scenario: redirect to right place after reply a picture comment | |
82 | -# Given the following files | |
83 | -# | owner | file | mime | | |
84 | -# | booking | rails.png | image/png | | |
85 | -# And the following comment | |
86 | -# | article | author | title | body | | |
87 | -# | rails.png | booking | root comment | this comment is not a reply | | |
88 | -# Given I am logged in as "booking" | |
89 | -# And I go to /booking/rails.png?view=true | |
90 | -# And I follow "Reply" within ".comment-balloon" | |
91 | -# And I fill in "Title" within "comment-balloon" with "Hey ho, let's go!" | |
92 | -# And I fill in "Enter your comment" within "comment-balloon" with "Hey ho, let's go!" | |
93 | -# When I press "Post comment" within ".comment-balloon" | |
94 | -# Then I should be exactly on /booking/rails.png?view=true | |
77 | + @selenium | |
78 | + Scenario: redirect to right place after reply a picture comment | |
79 | + Given the following files | |
80 | + | owner | file | mime | | |
81 | + | booking | rails.png | image/png | | |
82 | + And the following comment | |
83 | + | article | author | title | body | | |
84 | + | rails.png | booking | root comment | this comment is not a reply | | |
85 | + Given I am logged in as "booking" | |
86 | + And I go to /booking/rails.png?view=true | |
87 | + And I follow "Reply" within ".comment-balloon" | |
88 | + And I fill in "Title" within "comment-balloon" with "Hey ho, let's go!" | |
89 | + And I fill in "Enter your comment" within "comment-balloon" with "Hey ho, let's go!" | |
90 | + When I press "Post comment" within ".comment-balloon" | |
91 | + Then I should be exactly on /booking/rails.png?view=true | ... | ... |
features/enterprise_homepage.feature
... | ... | @@ -20,63 +20,18 @@ Feature: enterprise homepage |
20 | 20 | | soap | |
21 | 21 | And the following product |
22 | 22 | | name | category | owner | |
23 | - | Natural Handmade | soap | mayhem | | |
23 | + | Natural Handmade | soap | mayhem | | |
24 | 24 | |
25 | 25 | |
26 | -# should 'display profile info' do | |
27 | -# e = Enterprise.create!(:name => 'my test enterprise', :identifier => 'mytestenterprise', :contact_email => 'ent@noosfero.foo.bar', :contact_phone => '5555 5555') | |
28 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
29 | -# e.articles << a | |
30 | -# result = a.to_html | |
31 | -# assert_match /ent@noosfero.foo.bar/, result | |
32 | -# assert_match /5555 5555/, result | |
33 | -# end | |
34 | - | |
35 | 26 | Scenario: display profile info |
36 | 27 | When I go to /mayhem/homepage |
37 | 28 | Then I should see "queen@workerbees.org" |
38 | 29 | And I should see "(288) 555-0153" |
39 | 30 | |
40 | -# should 'display products list' do | |
41 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise') | |
42 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
43 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
44 | -# ent.articles << a | |
45 | -# result = a.to_html | |
46 | -# assert_match /Product test/, result | |
47 | -# end | |
48 | - | |
49 | 31 | Scenario: display products list |
50 | 32 | When I go to /mayhem/homepage |
51 | 33 | Then I should see "Natural Handmade" |
52 | 34 | |
53 | -# should 'not display products list if environment do not let' do | |
54 | -# e = Environment.default | |
55 | -# e.enable('disable_products_for_enterprises') | |
56 | -# e.save! | |
57 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise', :environment_id => e.id) | |
58 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
59 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
60 | -# ent.articles << a | |
61 | -# result = a.to_html | |
62 | -# assert_no_match /Product test/, result | |
63 | -# end | |
64 | - | |
65 | -# FIXME: not working | |
66 | -# Scenario: not display products list if environment do not let | |
67 | -# Given feature "disable_products_for_enterprises" is enabled on environment | |
68 | -# When I go to /mayhem/homepage | |
69 | -# Then I should not see "Natural Handmade" | |
70 | - | |
71 | -# should 'display link to product' do | |
72 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise') | |
73 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
74 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
75 | -# ent.articles << a | |
76 | -# result = a.to_html | |
77 | -# assert_match /\/test_enterprise\/manage_products\/show\/#{prod.id}/, result | |
78 | -# end | |
79 | - | |
80 | 35 | Scenario: display link to product |
81 | 36 | When I go to /mayhem/homepage |
82 | 37 | And I follow "Natural Handmade" | ... | ... |
features/manage_enterprises.feature
... | ... | @@ -11,13 +11,12 @@ Feature: manage enterprises |
11 | 11 | | identifier | name | owner | |
12 | 12 | | tangerine-dream | Tangerine Dream | joaosilva | |
13 | 13 | |
14 | -#FIXME: falha pois o clique em "My enterprises" não faz o popup aparecer | |
15 | -# @selenium | |
16 | -# Scenario: seeing my enterprises on menu | |
17 | -# Given I am logged in as "joaosilva" | |
18 | -# Then I should see "My enterprises" link | |
19 | -# When I follow "My enterprises" and wait | |
20 | -# Then I should see "Tangerine Dream" linking to "/myprofile/tangerine-dream" | |
14 | + @selenium | |
15 | + Scenario: seeing my enterprises on menu | |
16 | + Given I am logged in as "joaosilva" | |
17 | + Then I should see "My enterprises" link | |
18 | + When I follow "My enterprises" and wait | |
19 | + Then I should see "Tangerine Dream" linking to "/myprofile/tangerine-dream" | |
21 | 20 | |
22 | 21 | @selenium |
23 | 22 | Scenario: not show enterprises on menu to a user without enterprises | ... | ... |
features/manage_products.feature
... | ... | @@ -392,22 +392,21 @@ Feature: manage products |
392 | 392 | # And I should see "An used red bicycle" |
393 | 393 | # And I should be on Rede Moinho's page of product Bike |
394 | 394 | |
395 | -# FIXME Not working -- 'cancel' is not clicked for some reason | |
396 | -# @selenium | |
397 | -# Scenario: cancel edition of a product description | |
398 | -# Given the following product_category | |
399 | -# | name | | |
400 | -# | Bicycle | | |
401 | -# And the following products | |
402 | -# | owner | category | name | description | | |
403 | -# | redemoinho | bicycle | Bike | A new red bicycle | | |
404 | -# And I am logged in as "joaosilva" | |
405 | -# When I go to Rede Moinho's page of product Bike | |
406 | -# Then I should see "A new red bicycle" | |
407 | -# And I follow "Edit description" | |
408 | -# When I follow "Cancel" | |
409 | -# Then I should see "A new red bicycle" | |
410 | -# And I should be on Rede Moinho's page of product Bike | |
395 | + @selenium | |
396 | + Scenario: cancel edition of a product description | |
397 | + Given the following product_category | |
398 | + | name | | |
399 | + | Bicycle | | |
400 | + And the following products | |
401 | + | owner | category | name | description | | |
402 | + | redemoinho | bicycle | Bike | A new red bicycle | | |
403 | + And I am logged in as "joaosilva" | |
404 | + When I go to Rede Moinho's page of product Bike | |
405 | + Then I should see "A new red bicycle" | |
406 | + And I follow "Edit description" | |
407 | + When I follow "Cancel" | |
408 | + Then I should see "A new red bicycle" | |
409 | + And I should be on Rede Moinho's page of product Bike | |
411 | 410 | |
412 | 411 | @selenium |
413 | 412 | Scenario: Edit product category and save without select any category | ... | ... |
features/profile_domain.feature
1 | 1 | Feature: domain for profile |
2 | + | |
2 | 3 | As a user |
3 | 4 | I want access a profile by its own domain |
4 | 5 | |
... | ... | @@ -65,9 +66,8 @@ Feature: domain for profile |
65 | 66 | And I follow "Go to the home page" |
66 | 67 | Then the page title should be "Colivre.net" |
67 | 68 | |
68 | -# FIXME: the administration link doesn't appear | |
69 | -# @selenium | |
70 | -# Scenario: Compose link to administration with environment domain | |
71 | -# Given I am logged in as "joaosilva" | |
72 | -# When I visit "/" and wait | |
73 | -# Then I should see "Administration" linking to "http://127.0.0.1/admin" | |
69 | + @selenium | |
70 | + Scenario: Compose link to administration with environment domain | |
71 | + Given I am logged in as "joaosilva" | |
72 | + When I visit "/" and wait | |
73 | + Then I should see "Administration" linking to "http://127.0.0.1/admin" | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -150,16 +150,6 @@ Given /^the following products?$/ do |table| |
150 | 150 | data = item.dup |
151 | 151 | owner = Enterprise[data.delete("owner")] |
152 | 152 | category = Category.find_by_slug(data.delete("category").to_slug) |
153 | - img = Image.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
154 | - product = Product.create!(data.merge(:enterprise => owner, :product_category => category, :image_id => img.id)) | |
155 | - end | |
156 | -end | |
157 | - | |
158 | -Given /^the following simple products?$/ do |table| | |
159 | - table.hashes.each do |item| | |
160 | - data = item.dup | |
161 | - owner = Enterprise[data.delete("owner")] | |
162 | - category = Category.find_by_slug(data.delete("category").to_slug) | |
163 | 153 | data.merge!(:enterprise => owner, :product_category => category) |
164 | 154 | if data[:img] |
165 | 155 | img = Image.create!(:uploaded_data => fixture_file_upload('/files/'+data.delete("img")+'.png', 'image/png')) |
... | ... | @@ -167,7 +157,7 @@ Given /^the following simple products?$/ do |table| |
167 | 157 | end |
168 | 158 | if data[:qualifier] |
169 | 159 | qualifier = Qualifier.find_by_name(data.delete("qualifier")) |
170 | - data.merge!(:qualifiers => [qualifier]) | |
160 | + data.merge!(:qualifiers => [qualifier]) | |
171 | 161 | end |
172 | 162 | product = Product.create!(data) |
173 | 163 | end | ... | ... |
public/javascripts/catalog.js
1 | -function open() { | |
2 | - if (this.clicked) return; | |
3 | - jQuery(this).addClass('open'); | |
4 | -} | |
5 | - | |
6 | -function close() { | |
7 | - if (this.clicked) return; | |
8 | - jQuery(this).removeClass('open'); | |
9 | -} | |
1 | +(function($) { | |
10 | 2 | |
11 | -function click(e) { | |
12 | - jQuery(e).toggleClass('open', e.clicked); | |
13 | - jQuery(e).children('div').toggle(e.clicked).css({left: jQuery(e).position().left-180, top: jQuery(e).position().top-10}); | |
14 | -} | |
15 | - | |
16 | -function hover() { | |
17 | - jQuery(this).toggleClass('hover'); | |
18 | -} | |
19 | - | |
20 | -jQuery('#product-list .product .expand-box').hover(hover, hover).click(function () { | |
3 | +$('#product-list .product .expand-box').hover(hover, hover).live('click', function () { | |
21 | 4 | this.clicked = !this.clicked; |
22 | 5 | click(this); |
23 | - jQuery.each(jQuery(this).siblings('.expand-box'), function(index, value) { value.clicked = false; click(value); }); | |
6 | + $.each($(this).siblings('.expand-box'), function(index, value) { value.clicked = false; click(value); }); | |
24 | 7 | |
25 | 8 | return false; |
26 | 9 | }); |
27 | 10 | |
28 | -jQuery(document).click(function() { | |
29 | - jQuery.each(jQuery('#product-list .product .expand-box'), function(index, value) { value.clicked = false; click(value); }); | |
11 | +$(document).live('click', function() { | |
12 | + $.each($('#product-list .product .expand-box'), function(index, value) { value.clicked = false; click(value); }); | |
30 | 13 | }); |
31 | 14 | |
32 | 15 | var rows = {}; |
33 | -jQuery('#product-list .product').each(function (index, element) { | |
34 | - obj = rows[jQuery(element).offset().top] || {}; | |
16 | +$('#product-list .product').each(function (index, element) { | |
17 | + obj = rows[$(element).offset().top] || {}; | |
35 | 18 | |
36 | 19 | obj.heights = obj.heights || []; |
37 | 20 | obj.elements = obj.elements || []; |
38 | - obj.heights.push(jQuery(element).height()); | |
21 | + obj.heights.push($(element).height()); | |
39 | 22 | obj.elements.push(element); |
40 | 23 | |
41 | - rows[jQuery(element).offset().top] = obj; | |
24 | + rows[$(element).offset().top] = obj; | |
42 | 25 | }); |
43 | 26 | |
44 | -jQuery.each(rows, function(top, obj) { | |
27 | +$.each(rows, function(top, obj) { | |
45 | 28 | maxWidth = Array.max(obj.heights); |
46 | - jQuery(obj.elements).height(maxWidth); | |
29 | + $(obj.elements).height(maxWidth); | |
47 | 30 | }); |
48 | 31 | |
32 | +})(jQuery); | |
33 | + | |
34 | +function open() { | |
35 | + if (this.clicked) return; | |
36 | + jQuery(this).addClass('open'); | |
37 | +} | |
38 | + | |
39 | +function close() { | |
40 | + if (this.clicked) return; | |
41 | + jQuery(this).removeClass('open'); | |
42 | +} | |
43 | + | |
44 | +function click(e) { | |
45 | + jQuery(e).toggleClass('open', e.clicked); | |
46 | + jQuery(e).children('div').toggle(e.clicked).css({left: jQuery(e).position().left-180, top: jQuery(e).position().top-10}); | |
47 | +} | |
48 | + | |
49 | +function hover() { | |
50 | + jQuery(this).toggleClass('hover'); | |
51 | +} | ... | ... |
test/functional/catalog_controller_test.rb
... | ... | @@ -72,14 +72,6 @@ class CatalogControllerTest < Test::Unit::TestCase |
72 | 72 | assert_tag :tag => 'span', :attributes => { :class => 'product-price with-discount' }, :content => /50.00/ |
73 | 73 | end |
74 | 74 | |
75 | -# should 'link to assets products with product category in the link to product category on index' do | |
76 | -# pc = ProductCategory.create!(:name => 'some product', :environment => enterprise.environment) | |
77 | -# prod = enterprise.products.create!(:name => 'Product test', :price => 50.00, :product_category => pc) | |
78 | -# | |
79 | -# get :index, :profile => enterprise.identifier | |
80 | -# assert_tag :tag => 'a', :attributes => {:href => /assets\/products\?product_category=#{pc.id}/} | |
81 | -# end | |
82 | - | |
83 | 75 | should 'add an zero width space every 4 caracters of comment urls' do |
84 | 76 | url = 'www.an.url.to.be.splited.com' |
85 | 77 | prod = @enterprise.products.create!(:name => 'Product test', :price => 50.00, :product_category => @product_category, :description => url) | ... | ... |
test/functional/maps_controller_test.rb
... | ... | @@ -22,12 +22,12 @@ class MapsControllerTest < Test::Unit::TestCase |
22 | 22 | assert_equal 'new address', Profile['test_profile'].address |
23 | 23 | end |
24 | 24 | |
25 | -# should 'back when update address fail' do | |
26 | -# Profile.any_instance.stubs(:update_attributes!).returns(false) | |
27 | -# post :edit_location, :profile => profile.identifier, :profile_data => { 'address' => 'new address' } | |
28 | -# assert_nil profile.address | |
29 | -# assert_template 'edit_location' | |
30 | -# end | |
25 | + should 'back when update address fail' do | |
26 | + Profile.any_instance.stubs(:update_attributes!).returns(false) | |
27 | + post :edit_location, :profile => profile.identifier, :profile_data => { 'address' => 'new address' } | |
28 | + assert_nil profile.address | |
29 | + assert_template 'edit_location' | |
30 | + end | |
31 | 31 | |
32 | 32 | should 'show page to edit location' do |
33 | 33 | get :edit_location, :profile => profile.identifier | ... | ... |
test/unit/enterprise_homepage_test.rb
... | ... | @@ -16,47 +16,6 @@ class EnterpriseHomepageTest < Test::Unit::TestCase |
16 | 16 | assert_kind_of String, EnterpriseHomepage.description |
17 | 17 | end |
18 | 18 | |
19 | -# These tests are being moved into features, since they're view tests | |
20 | - | |
21 | -# should 'display profile info' do | |
22 | -# e = Enterprise.create!(:name => 'my test enterprise', :identifier => 'mytestenterprise', :contact_email => 'ent@noosfero.foo.bar', :contact_phone => '5555 5555') | |
23 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
24 | -# e.articles << a | |
25 | -# result = a.to_html | |
26 | -# assert_match /ent@noosfero.foo.bar/, result | |
27 | -# assert_match /5555 5555/, result | |
28 | -# end | |
29 | - | |
30 | -# should 'display products list' do | |
31 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise') | |
32 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
33 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
34 | -# ent.articles << a | |
35 | -# result = a.to_html | |
36 | -# assert_match /Product test/, result | |
37 | -# end | |
38 | - | |
39 | -# should 'not display products list if environment do not let' do | |
40 | -# e = Environment.default | |
41 | -# e.enable('disable_products_for_enterprises') | |
42 | -# e.save! | |
43 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise', :environment_id => e.id) | |
44 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
45 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
46 | -# ent.articles << a | |
47 | -# result = a.to_html | |
48 | -# assert_no_match /Product test/, result | |
49 | -# end | |
50 | - | |
51 | -# should 'display link to product' do | |
52 | -# ent = fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'Test enteprise') | |
53 | -# prod = ent.products.create!(:name => 'Product test', :product_category => @product_category) | |
54 | -# a = EnterpriseHomepage.new(:name => 'article homepage') | |
55 | -# ent.articles << a | |
56 | -# result = a.to_html | |
57 | -# assert_match /\/test_enterprise\/manage_products\/show\/#{prod.id}/, result | |
58 | -# end | |
59 | - | |
60 | 19 | should 'return a valid body' do |
61 | 20 | e = EnterpriseHomepage.new(:name => 'sample enterprise homepage') |
62 | 21 | assert_not_nil e.to_html | ... | ... |