tags around removed text on the left div" do
+ before = "this is a great paragraph
"
+ after = "this is a paragraph
"
+ DiscourseDiff.new(before, after).side_by_side_html.should == "this is a great paragraph
"
+ end
+
+ it "adds .diff-ins class when a paragraph is added" do
+ before = "this is the first paragraph
"
+ after = "this is the first paragraph
this is the second paragraph
"
+ DiscourseDiff.new(before, after).side_by_side_html.should == "this is the first paragraph
this is the first paragraph
this is the second paragraph
"
+ end
+
+ it "adds .diff-del class when a paragraph is removed" do
+ before = "this is the first paragraph
this is the second paragraph
"
+ after = "this is the second paragraph
"
+ DiscourseDiff.new(before, after).side_by_side_html.should == "this is the first paragraph
this is the second paragraph
this is the second paragraph
"
+ end
+
+ end
+
+ describe "side_by_side_markdown" do
+
+ it "returns an empty table when no content is diffed" do
+ DiscourseDiff.new("", "").side_by_side_markdown.should == ""
+ end
+
+ it "properly escape html tags" do
+ before = ""
+ after = "\""
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == " | <img src="//domain.com/image.png>" |
"
+ end
+
+ it "returns the diffed content on both columns when there is no difference" do
+ before = after = "this is a paragraph"
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == "this is a paragraph | this is a paragraph |
"
+ end
+
+ it "adds tags around added text on the second column" do
+ before = "this is a paragraph"
+ after = "this is a great paragraph"
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == "this is a paragraph | this is a great paragraph |
"
+ end
+
+ it "adds tags around removed text on the first column" do
+ before = "this is a great paragraph"
+ after = "this is a paragraph"
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == "this is a great paragraph | this is a paragraph |
"
+ end
+
+ it "adds .diff-ins class when a paragraph is added" do
+ before = "this is the first paragraph"
+ after = "this is the first paragraph\nthis is the second paragraph"
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == "this is the first paragraph | this is the first paragraph\nthis is the second paragraph |
"
+ end
+
+ it "adds .diff-del class when a paragraph is removed" do
+ before = "this is the first paragraph\nthis is the second paragraph"
+ after = "this is the second paragraph"
+ DiscourseDiff.new(before, after).side_by_side_markdown.should == "this is the first paragraph\n | |
this is the second paragraph | this is the second paragraph |
"
+ end
+
+ end
+
+end
+