Add translate="no" to outgoing mentions and links (#25524)
This commit is contained in:
@@ -38,6 +38,14 @@ describe Sanitize::Config do
|
||||
expect(Sanitize.fragment('<a href="http://example.com">Test</a>', subject)).to eq '<a href="http://example.com" rel="nofollow noopener noreferrer" target="_blank">Test</a>'
|
||||
end
|
||||
|
||||
it 'keeps a with translate="no"' do
|
||||
expect(Sanitize.fragment('<a href="http://example.com" translate="no">Test</a>', subject)).to eq '<a href="http://example.com" translate="no" rel="nofollow noopener noreferrer" target="_blank">Test</a>'
|
||||
end
|
||||
|
||||
it 'removes "translate" attribute with invalid value' do
|
||||
expect(Sanitize.fragment('<a href="http://example.com" translate="foo">Test</a>', subject)).to eq '<a href="http://example.com" rel="nofollow noopener noreferrer" target="_blank">Test</a>'
|
||||
end
|
||||
|
||||
it 'removes a with unparsable href' do
|
||||
expect(Sanitize.fragment('<a href=" https://google.fr">Test</a>', subject)).to eq 'Test'
|
||||
end
|
||||
|
Reference in New Issue
Block a user