Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Diff/testcases

From Wikipedia, the free encyclopedia
-- 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: var(--background-color-content-removed,#ffe49c); vertical-align:top; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; color: inherit; 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: var(--background-color-content-added,#a3d3ff); vertical-align:top; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; color: inherit; 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: var(--background-color-content-removed,#ffe49c); vertical-align:top; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; color: inherit; 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: var(--background-color-content-removed,#ffe49c); color: inherit; padding: 0.25em 0; font-weight: bold; text-decoration: initial;">one</del>&#32;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: var(--background-color-content-added,#a3d3ff); vertical-align:top; width: 48%; border-style: solid; border-radius: 0.33em; padding: 0.33em 0.5em; color: inherit; 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: var(--background-color-content-added,#a3d3ff); color: inherit; padding: 0.25em 0; font-weight: bold; text-decoration: initial;">a</ins>&#32;change</div></td></tr></table>')
end

return p