diff options
author | Patrick Derichs <pderichs@gitlab.com> | 2019-04-23 16:32:51 +0200 |
---|---|---|
committer | Patrick Derichs <pderichs@gitlab.com> | 2019-04-23 16:32:51 +0200 |
commit | d2d53726ecd1245a5999681e0fa016c68cd8e098 (patch) | |
tree | f086fb18273ecbac38e7b8b425acd07ff00a8c2e | |
parent | 6c913f2c65ec4ddffaf4a79fc15ea933325e51f4 (diff) | |
download | gitlab-ce-pderichs-58229.tar.gz |
Add failing specpderichs-58229
-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]) |