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:
Konrad
2023-11-28 11:09:35 +01:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

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

View File

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