Content deleted Content added
add renderPadlock test |
fix renderImage test and add another |
||
Line 8:
-- Helper functions
--------------------------------------------------------------------------------
-- Escapes the magic characters ()%.[]*+-?^$ for use in Lua patterns.
return s:gsub('([%(%)%.%[%]%*%+%-%?%^%$%%])', '%%%1')
end
function suite:assertCategoryEquals(expected, protType, protLevel, namespace, reason, expiry)
Line 954 ⟶ 959:
--------------------------------------------------------------------------------
d.padlockDivStartDefault = '<div class="metadata topicon nopopups" id="protected-icon" style="display:none;right:55px;">'
▲function suite:testRenderPadlock()
d.padlockDivEnd = '</div>'
d.imagePattern = '%[%[Image:.-%]%]'
local actual = pp.renderPadlock{▼
function suite:testRenderPadlockDefault()
local expected = suite.escapePattern(d.padlockDivStartDefault)
.. d.imagePattern
.. suite.escapePattern(d.padlockDivEnd)
end
▲ self:assertEquals(expected, actual)
function suite:testRenderPadlockDefault()
local expected = suite.escapePattern(d.padlockDivStart65px)
.. d.imagePattern
.. suite.escapePattern(d.padlockDivEnd)
local actual = pp.renderPadlock('[[Image:Padlock.svg|20px]]', 65)
self:assertStringContains(expected, actual)
end
|