Escape values of HTML attributes

This commit is contained in:
Dmitry Klimensky
2021-08-10 16:14:37 +03:00
committed by Robin Ward
parent 7dc8f8b794
commit d54b339809
2 changed files with 6 additions and 1 deletions

View File

@ -107,6 +107,11 @@ describe DiscourseDiff do
expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("<div class=\"revision-content\"><p><del>&#39;</del></p></div><div class=\"revision-content\"><p></p></div>")
end
it "escapes attribute values" do
before = "<p data-attr='Some \"quoted\" string'></p>"
after = "<p data-attr='Some \"quoted\" string'></p>"
expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("<div class=\"revision-content\"><p data-attr=\"Some &quot;quoted&quot; string\"></p></div><div class=\"revision-content\"><p data-attr=\"Some &quot;quoted&quot; string\"></p></div>")
end
end
describe "side_by_side_markdown" do