Revert specs changed for external redirect behavior again when not active

This commit is contained in:
Oliver Günther
2026-02-23 08:38:28 +01:00
parent 8e0b351367
commit 6e8df4ce22
7 changed files with 11 additions and 18 deletions
+1 -2
View File
@@ -54,8 +54,7 @@ RSpec.describe "External links", :js do
document.body.appendChild(link);
JS
href = external_redirect_path(url: "https://example.com/")
link = page.find_link("External Example", href:, match: :first)
link = page.find_link("External Example", href: "https://example.com", match: :first)
# Verify accessibility and security attributes
expect(link[:target]).to eq("_blank")
+1 -2
View File
@@ -51,8 +51,7 @@ RSpec.describe "External link capture", :js, :selenium do
it "keeps the default external link behaviour" do
visit project_wiki_path(project, wiki_page)
href = external_redirect_path(url: external_url)
link = page.find_link("OpenProject", href:)
link = page.find_link("OpenProject", href: external_url)
new_window = window_opened_by { link.click }
within_window new_window do
@@ -203,8 +203,7 @@ RSpec.describe "Edit project custom fields on project overview page", :js do
it "renders the custom field as a link" do
page.within_test_selector "project-custom-field-#{link_project_custom_field.id}" do
href = external_redirect_path(url: "https://www.openproject.org/")
expect(page).to have_link("https://www.openproject.org", href:)
expect(page).to have_link("https://www.openproject.org", href: "https://www.openproject.org")
end
end
end
@@ -47,8 +47,7 @@ RSpec.describe "Wiki page external link", :js, :selenium do
it "opens that link in a new window or tab" do
visit project_wiki_path(project, wiki_page)
href = external_redirect_path(url: external_url)
link = page.find_link("OpenProject", href:)
link = page.find_link("OpenProject", href: external_url)
new_window = window_opened_by { link.click }
within_window new_window do
expect(page.current_url).to start_with external_url
@@ -251,8 +251,7 @@ RSpec.describe "custom field inplace editor", :js do
field.update "http://example.com"
field.expect_state_text "http://example.com"
href = external_redirect_path(url: "http://example.com/")
expect(field.display_element).to have_link("http://example.com", href:)
expect(field.display_element).to have_link("http://example.com", href: "http://example.com")
field.update "bogus", expect_failure: true
@@ -262,8 +261,8 @@ RSpec.describe "custom field inplace editor", :js do
field.save!
field.expect_state_text "http://community.openproject.org"
href = external_redirect_path(url: "http://community.openproject.org/")
expect(field.display_element).to have_link("http://community.openproject.org", href:)
expect(field.display_element).to have_link("http://community.openproject.org",
href: "http://community.openproject.org")
end
end
end
@@ -186,11 +186,9 @@ RSpec.describe "Todolists in CKEditor", :js, :selenium do
expect(page).to have_css(".op-uc-list--task-checkbox", count: 3)
expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 1)
link = external_redirect_path(url: "https://community.openproject.com/")
expect(page).to have_css(".op-uc-list--item a[href='#{link}']")
expect(page).to have_css(".op-uc-list--item a[href='https://community.openproject.com/']")
link = external_redirect_path(url: "https://community.openproject.com/nested")
nested_link = page.find(".op-uc-list--item .op-uc-list--item a[href='#{link}']")
nested_link = page.find(".op-uc-list--item .op-uc-list--item a[href='https://community.openproject.com/nested']")
expect(nested_link.text).to eq "This is a link"
description = WorkPackage.last.description
+2 -2
View File
@@ -59,7 +59,7 @@ RSpec.describe "Wysiwyg linking", :js do
"[http://example.org/link with spaces](http://example.org/link%20with%20spaces)"
)
expect(page).to have_link(href: external_redirect_path(url: "http://example.org/link%20with%20spaces"))
expect(page).to have_link(href: "http://example.org/link%20with%20spaces")
end
end
@@ -76,7 +76,7 @@ RSpec.describe "Wysiwyg linking", :js do
editor.insert_link "https://example.org/path"
click_on "Save"
expect_flash(message: "Successful update.")
expect(page).to have_link(href: external_redirect_path(url: "https://example.org/path"))
expect(page).to have_link(href: "https://example.org/path")
end
it "allows linking the custom protocol" do