Jump to content

Module:Userbox/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 18:13, 8 January 2014 (add the first few render tests). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
-- Unit tests for [[Module:Userbox]]. Click talk page to run tests.
local ubx = require('Module:Userbox')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

local userbox = ubx.userbox
local userbox2 = ubx['userbox-2']
local userboxr = ubx['userbox-r']
local render = ubx.render

function suite:testRenderFloat()
    self:assertStringContains('float:right;', render{float="right"})
end

function suite:testRenderBorder()
    self:assertStringContains('border:5px', render{borderWidth="5px"})
    self:assertStringContains('solid red', render{borderColor="red"})
end

function suite:testRenderMargin()
    self:assertStringContains('margin:1px;', render{})
end

function suite:testRenderWidth()
    self:assertStringContains('width:120px;', render{width="120px"})
end

function suite:testRenderUserboxClass()
    self:assertStringContains('wikipediauserbox', render{})
end

function suite:testRenderUserboxClass()
    self:assertStringContains('wikipediauserbox', render{})
end

return suite