Do not shows <a /> if producers is hidden

Different style as it does not open any modal
This commit is contained in:
Jean-Baptiste Bellet
2023-03-09 16:08:19 +01:00
parent c5779eff81
commit e78b44b9ca
2 changed files with 40 additions and 9 deletions

View File

@@ -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 }}

View File

@@ -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