mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #8347 from achauve/8227-fix-opening-product-description-links-in-new-tabs
Fix: product edition doesn't break description links
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
|
||||
= f.field_container :description do
|
||||
= f.label :description, t(:description)
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', "textangular-links-target-blank" => true, 'ta-toolbar' => "[['bold','italics','underline','clear'],['insertLink']]"}
|
||||
= sanitize(@product.description)
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', 'textangular-unsafe-sanitizer' => true, "textangular-links-target-blank" => true, 'ta-toolbar' => "[['bold','italics','underline','clear'],['insertLink']]"}
|
||||
= sanitize(@product.description, attributes: ["href", "target"])
|
||||
= f.error_message_on :description
|
||||
|
||||
.right.four.columns.omega
|
||||
|
||||
@@ -31,7 +31,7 @@ describe "As a consumer I want to view products", js: true do
|
||||
end
|
||||
|
||||
it "shows HTML product description" do
|
||||
product.description = "<p><b>Formatted</b> product description.</p>"
|
||||
product.description = '<p><b>Formatted</b> product description.</p> Link to an <a href="http://google.fr" target="_blank">external site</a>'
|
||||
product.save!
|
||||
|
||||
visit shop_path
|
||||
@@ -42,7 +42,26 @@ describe "As a consumer I want to view products", js: true do
|
||||
modal_should_be_open_for product
|
||||
|
||||
within(".reveal-modal") do
|
||||
expect(html).to include("<p><b>Formatted</b> product description.</p>")
|
||||
expect(html).to include('<p><b>Formatted</b> product description.</p> Link to an <a href="http://google.fr" target="_blank">external site</a>')
|
||||
end
|
||||
|
||||
# -- edit product via admin interface
|
||||
login_as_admin_and_visit spree.edit_admin_product_path(product)
|
||||
expect(page.find("div[id^='taTextElement']")['innerHTML']).to include('<a href="http://google.fr" target="_blank">external site</a>')
|
||||
|
||||
fill_in 'product_name', with: product.name + "_update"
|
||||
click_button 'Update'
|
||||
|
||||
# -- check back consumer product view
|
||||
visit shop_path
|
||||
expect(page).to have_content(product.name + "_update")
|
||||
click_link(product.name + "_update")
|
||||
|
||||
expect(page).to have_selector '.reveal-modal'
|
||||
modal_should_be_open_for product
|
||||
|
||||
within(".reveal-modal") do
|
||||
expect(html).to include('<p><b>Formatted</b> product description.</p> Link to an <a href="http://google.fr" target="_blank">external site</a>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user