require 'rails_helper'
require 'discourse_diff'
describe DiscourseDiff do
describe "inline_html" do
it "does not lead to XSS" do
a = "
this is a paragraph
" expect(DiscourseDiff.new(before, after).inline_html).to eq("this is a paragraph
this is a paragraph
" after = "this is a great paragraph
" expect(DiscourseDiff.new(before, after).inline_html).to eq("this is a great paragraph
this is a great paragraph
" after = "this is a paragraph
" expect(DiscourseDiff.new(before, after).inline_html).to eq("this is a great paragraph
this is the first paragraph
" after = "this is the first paragraph
this is the second paragraph
" expect(DiscourseDiff.new(before, after).inline_html).to eq("this is the first paragraph
this is the second paragraph
this is the first paragraph
this is the second paragraph
" after = "this is the second paragraph
" expect(DiscourseDiff.new(before, after).inline_html).to eq("this is the first paragraph
this is the second paragraph
this is a paragraph
" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("this is a paragraph
this is a paragraph
this is a paragraph
" after = "this is a great paragraph
" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("this is a paragraph
this is a great paragraph
this is a great paragraph
" after = "this is a paragraph
" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("this is a great paragraph
this is a paragraph
this is the first paragraph
" after = "this is the first paragraph
this is the second paragraph
" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("this is the first paragraph
this is the first paragraph
this is the second paragraph
this is the first paragraph
this is the second paragraph
" after = "this is the second paragraph
" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("this is the first paragraph
this is the second paragraph
this is the second paragraph
<img src="//domain.com/image.png>" |
this is a paragraph | this is a paragraph |
this is a paragraph | this is a great paragraph |
this is a | this is a paragraph |
this is the first paragraph | this is the first paragraph\nthis is the second paragraph |
this is the first paragraph\n | |
this is the second paragraph | this is the second paragraph |