-- Unit tests for [[Module:Diff]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_no_change()
self:preprocess_equals('{{#invoke:Diff|main|no change|no change}}', '<table class="diff" style="width:100%"><tr><td class="diff-marker" style="width: 2%; padding: 0.25em; font-weight: bold;font-size: 1.25em; text-align: end;">−</td><td class="diff-deletedline" style="border-color: #ffe49c; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; font-size: 1em; font-family: monospace; white-space: pre-wrap; border-width: 1px 1px 1px 4px; -webkit-border-end-width: 1px; -webkit-border-start-width: 4px; -moz-border-end-width: 1px; -moz-border-start-width: 4px;"><div style="word-wrap: break-word; direction: ltr;">no change</div></td><td style="width: 2%; padding: 0.25em; font-weight: bold;font-size: 1.25em; text-align: end;">+</td><td class="diff-addedline" style="border-color: #a3d3ff; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; font-size: 1em; font-family: monospace; white-space: pre-wrap; border-width: 1px 1px 1px 4px; -webkit-border-end-width: 1px; -webkit-border-start-width: 4px; -moz-border-end-width: 1px; -moz-border-start-width: 4px;"><div style="word-wrap: break-word; direction: ltr;">no change</div></td></tr></table>')
end
function p:test_one_change()
self:preprocess_equals('{{#invoke:Diff|main|one change|a change}}', '<table class="diff" style="width:100%"><tr><td class="diff-marker" style="width: 2%; padding: 0.25em; font-weight: bold;font-size: 1.25em; text-align: end;">−</td><td class="diff-deletedline" style="border-color: #ffe49c; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; font-size: 1em; font-family: monospace; white-space: pre-wrap; border-width: 1px 1px 1px 4px; -webkit-border-end-width: 1px; -webkit-border-start-width: 4px; -moz-border-end-width: 1px; -moz-border-start-width: 4px;"><div style="word-wrap: break-word; direction: ltr;"><del class="diffchange diffchange-inline" style="background: #feeec8; padding: 0.25em 0; font-weight: bold; text-decoration: initial;">one</del> change</div></td><td style="width: 2%; padding: 0.25em; font-weight: bold;font-size: 1.25em; text-align: end;">+</td><td class="diff-addedline" style="border-color: #a3d3ff; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; font-size: 1em; font-family: monospace; white-space: pre-wrap; border-width: 1px 1px 1px 4px; -webkit-border-end-width: 1px; -webkit-border-start-width: 4px; -moz-border-end-width: 1px; -moz-border-start-width: 4px;"><div style="word-wrap: break-word; direction: ltr;"><ins class="diffchange diffchange-inline" style="background: #d8ecff; padding: 0.25em 0; font-weight: bold; text-decoration: initial;">a</ins> change</div></td></tr></table>')
end
return p