diff --git a/app/views/shopping_shared/tabs/_producers.html.haml b/app/views/shopping_shared/tabs/_producers.html.haml index 1a982851d1..1627896d1d 100644 --- a/app/views/shopping_shared/tabs/_producers.html.haml +++ b/app/views/shopping_shared/tabs/_producers.html.haml @@ -6,6 +6,9 @@ = t :shopping_producers_of_hub, hub: '{{ shopfront.name }}' %ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3 %li{"ng-repeat" => "enterprise in shopfront.producers"} - %enterprise-modal + %enterprise-modal{"ng-if": "enterprise.visible != 'hidden'"} + %i.ofn-i_036-producers + {{ enterprise.name }} + %span{"ng-if": "enterprise.visible == 'hidden'"} %i.ofn-i_036-producers {{ enterprise.name }} diff --git a/spec/system/consumer/shopping/shopping_spec.rb b/spec/system/consumer/shopping/shopping_spec.rb index dcaaf641e0..a70bb0818e 100644 --- a/spec/system/consumer/shopping/shopping_spec.rb +++ b/spec/system/consumer/shopping/shopping_spec.rb @@ -42,15 +42,43 @@ describe "As a consumer I want to shop with a distributor" do expect(first("distributor img")['src']).to include "logo-white.png" end - it "shows the producers for a distributor" do - exchange = Exchange.find(oc1.exchanges.to_enterprises(distributor).outgoing.first.id) - add_variant_to_order_cycle(exchange, variant) - - visit shop_path - within ".tab-buttons" do - click_link "Producers" + describe "producers tab" do + before do + exchange = Exchange.find(oc1.exchanges.to_enterprises(distributor).outgoing.first.id) + add_variant_to_order_cycle(exchange, variant) + visit shop_path + within ".tab-buttons" do + click_link "Producers" + end + end + + it "shows the producers for a distributor" do + expect(page).to have_content supplier.name + find("a", text: supplier.name).click + within ".reveal-modal" do + expect(page).to have_content supplier.name + end + end + + context "when the producer visibility is set to 'hidden'" do + before do + supplier.visible = "hidden" + supplier.save + visit shop_path + within ".tab-buttons" do + click_link "Producers" + end + end + + it "shows the producer name" do + expect(page).to have_content supplier.name + end + + it "does not show the producer modal" do + expect(page).to_not have_link supplier.name + expect(page).to_not have_selector ".reveal-modal" + end end - expect(page).to have_content supplier.name end describe "selecting an order cycle" do