summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-09-26 22:34:44 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-09-26 22:34:44 +0000
commit0bb977cb4157eb0ca689a276abee25a4b5992bbc (patch)
tree5adfcb190e143ca2e9a6734cd2eb69a016aafe7e /test
parentf733508d8a5068f713c0c8434485f047a4c5a288 (diff)
downloadredmine-0bb977cb4157eb0ca689a276abee25a4b5992bbc.tar.gz
redmine-0bb977cb4157eb0ca689a276abee25a4b5992bbc.zip
Add rel="noopener" to all external links with a target attribute (#37713).
Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@21849 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb b/test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb
index d4b76c401..f46f69c2e 100644
--- a/test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb
@@ -50,5 +50,10 @@ if Object.const_defined?(:CommonMarker)
filter(%(<a href="http://example.com/foo#bar#">Malformed URI</a>))
end
end
+
+ def test_external_links_with_target_get_rel_noopener
+ assert_equal %(<a target="_blank" href="http://example.net/" class="external" rel="noopener">link</a>), filter(%(<a target="_blank" href="http://example.net/">link</a>))
+ assert_equal %(<a target="_blank" href="http://example.net/" rel="nofollow noopener" class="external">link</a>), filter(%(<a target="_blank" href="http://example.net/" rel="nofollow">link</a>))
+ end
end
end