mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Merge pull request #11837 from binarygit/open-link-in-new-page
Open external link in product description inside new page
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
%h3
|
||||
%a{"ng-click" => "triggerProductModal()", href: 'javascript:void(0)'}
|
||||
%span{"ng-bind" => "::product.name"}
|
||||
.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}}
|
||||
.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}, "data-controller": "add-blank-to-link"}
|
||||
%div{ "ng-switch" => "enterprise.visible" }
|
||||
.product-producer
|
||||
= t :products_from
|
||||
|
||||
@@ -113,6 +113,14 @@ describe "As a consumer I want to view products" do
|
||||
expect(page).to have_content "alert('Dangerous!'); Safe"
|
||||
end
|
||||
end
|
||||
|
||||
it "opens link in product description inside another window" do
|
||||
product.description = "<a href='https://api.rubyonrails.org/'>external site</a>"
|
||||
product.save!
|
||||
|
||||
visit shop_path
|
||||
expect(find_link('external site')[:target]).to eq('_blank')
|
||||
end
|
||||
end
|
||||
|
||||
describe "filtering" do
|
||||
|
||||
Reference in New Issue
Block a user