Test Cases - HTML Diff

data-diff-key

should return the same HTML element if no changes are made

Before

After

Diff Result


should highlight added element

Before

After

Diff Result


should mark changed element as modified without data-diff-mode

Before

After

Diff Result


should preserve escaped attribute values when text changes

Before

After

Diff Result


data-diff-mode='element'

should use atomic element diffing when data-diff-mode="element" is specified

Before

After

Diff Result


should not duplicate identical element-mode nodes

Before

After

Diff Result


should handle element diffing with existing classes

Before

After

Diff Result


data-diff-mode='words'

should highlight added text within a paragraph

Before

After

Diff Result


should keep escaped text when doing word-level diffing

Before

After

Diff Result


should highlight removed text within a paragraph

Before

After

Diff Result


should handle text changes with both additions and removals

Before

After

Diff Result


should merge diff classes with existing classes

Before

After

Diff Result


data-diff-show-when-removed

should insert removed element when it has data-diff-show-when-removed

Before

After

Diff Result


should NOT insert removed element when it lacks data-diff-show-when-removed

Before

After

Diff Result


should handle mixed scenarios - some elements show when removed, others don't

Before

After

Diff Result


should preserve escaped text when re-inserting removed elements

Before

After

Diff Result