diff options
-rw-r--r-- | spec/lib/banzai/redactor_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/lib/banzai/redactor_spec.rb b/spec/lib/banzai/redactor_spec.rb index aaeec953e4b..534d2a5b15d 100644 --- a/spec/lib/banzai/redactor_spec.rb +++ b/spec/lib/banzai/redactor_spec.rb @@ -39,12 +39,19 @@ describe Banzai::Redactor do redactor.redact([doc]) expect(doc.to_html).to eq(original_content) end + + it 'does not replaces redacted reference with original content' do + html = "<a href='https://www.gitlab.com' data-link-reference='true' class='gfm' data-reference-type='issue' data-reference-type='issue' data-original='Marge'>Marge</a>" + doc = Nokogiri::HTML.fragment(html) + redactor.redact([doc]) + expect(doc.to_html).to eq('<a href="https://www.gitlab.com">Marge</a>') + end end it 'returns <a> tag with original href if it is originally a link reference' do href = 'http://localhost:3000' doc = Nokogiri::HTML - .fragment("<a class='gfm' data-reference-type='issue' data-original=#{href} data-link-reference='true'>#{href}</a>") + .fragment("<a class='gfm' data-reference-type='issue' data-original=\"#{href}\" data-link-reference='true'>#{href}</a>") redactor.redact([doc]) |