a
' b = 'ab
c' diff = TestDiff.diff(a, b) expect(diff).to eq("
aab
c")
end
+
+ describe "ignore_tags option" do
+ describe "changes in properties should render balanced tags" do
+ describe "when disabled" do
+ it "will render both versions of the start tag, but not end tag" do
+ a = 'a b'
+ b = 'a c'
+ expected = 'a first second first first first second first first Han går til samtaler ved en psykiater. Like a boss. Han drikker stærk spiritus. Like a boss. Han Han går til samtaler ved en psykiater. Like a boss. Han drikker stærk spiritus. Like a boss. Han bc'
+ diff = TestDiff.diff(a, b, ignore_tags: false)
+ expect(diff).to eq(expected)
+ end
+
+ it "will render both versions of the start tag, but not end tag" do
+ a = 'a b ce'
+ b = 'a c de'
+ expected = 'a bc cde'
+ diff = TestDiff.diff(a, b, ignore_tags: false)
+ expect(diff).to eq(expected)
+ end
+ end
+
+ describe "when enabled" do
+ it "will produce valid html" do
+ a = 'a b'
+ b = 'a c'
+ expected = 'a bc'
+ diff = TestDiff.diff(a, b, ignore_tags: true)
+ expect(diff).to eq(expected)
+ end
+
+ it "will produce valid html" do
+ a = 'a b ce'
+ b = 'a c de'
+ expected = 'a bc cde'
+ diff = TestDiff.diff(a, b, ignore_tags: true)
+ expect(diff).to eq(expected)
+ end
+ end
+ end
+
+ describe "removing tag with similar siblings" do
+ describe "when disabled" do
+ it "should show deleted paragraph" do
+ a = 'second
'
+ b = 'my list
'
+ expected = 'my list
'
+ diff = TestDiff.diff(a, b, ignore_tags: false)
+ expect(diff).to eq(expected)
+ end
+ end
+
+ describe "when enabled" do
+ it "should show deleted paragraph" do
+ a = 'item bsecond
'
+ b = 'my list
'
+ expected = 'my list
'
+ diff = TestDiff.diff(a, b, ignore_tags: true)
+ expect(diff).to eq(expected)
+ end
+ end
+ end
+ end
+
+ describe "reduce_consecutive option" do
+ it "should diff individual words, when not enabled" do
+ a = 'item bgårdrikker tilstærk samtaler ved en psykiater.spiritus. Like a boss.går til samtaler ved en psykiater.drikker stærk spiritus. Like a boss.