Add links to external site in product view test

This commit is contained in:
Adrien Chauve
2021-10-17 23:52:03 +02:00
parent ef68791fd6
commit 1a185ade03

View File

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