# frozen_string_literal: true
require 'discourse_diff'
RSpec.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
'
" after = "" expect(DiscourseDiff.new(before, after).inline_html).to eq("'
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 one paragraph
here is yet another
" after = "this is one great paragraph
here is another
" got = DiscourseDiff.new(before, after).side_by_side_html expect(got).to eq("this is one paragraph
here is yet another
this is one great paragraph
here is another
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
'
" after = "" expect(DiscourseDiff.new(before, after).side_by_side_html).to eq("'
<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 |