about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-02-09 12:56:12 +0100
committerGitHub <noreply@github.com>2020-02-09 12:56:12 +0100
commitd3aaa08730901e7c97c6aeb1ebf56f2a027c78a2 (patch)
tree9fcb99dab28b01e0f85fbe7f27f406f92a031903 /spec
parenta2cfe3daaadabfaad71969a44c460bd76b8405ff (diff)
parent432033743c409356bd11e0d7d96f14a3cc82fb77 (diff)
Merge pull request #1280 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/sanitize_config_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/sanitize_config_spec.rb b/spec/lib/sanitize_config_spec.rb
index c5143bcef..50558a0d8 100644
--- a/spec/lib/sanitize_config_spec.rb
+++ b/spec/lib/sanitize_config_spec.rb
@@ -14,5 +14,21 @@ describe Sanitize::Config do
     it 'keeps ul' do
       expect(Sanitize.fragment('<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>', subject)).to eq '<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>'
     end
+
+    it 'removes a without href' do
+      expect(Sanitize.fragment('<a>Test</a>', subject)).to eq 'Test'
+    end
+
+    it 'removes a without href and only keeps text content' do
+      expect(Sanitize.fragment('<a><span class="invisible">foo&amp;</span><span>Test</span></a>', subject)).to eq 'foo&amp;Test'
+    end
+
+    it 'removes a with unsupported scheme in href' do
+      expect(Sanitize.fragment('<a href="foo://bar">Test</a>', subject)).to eq 'Test'
+    end
+
+    it 'keeps a with href' do
+      expect(Sanitize.fragment('<a href="http://example.com">Test</a>', subject)).to eq '<a href="http://example.com" rel="nofollow noopener tag noreferrer" target="_blank">Test</a>'
+    end
   end
 end