Module:Template test case: Difference between revisions
add TestCase:renderRows
(add a comment) |
(add TestCase:renderRows) |
||
Line 204: | Line 204: | ||
end | end | ||
return tostring(root) | |||
end | |||
function TestCase:renderRows() | |||
local root = mw.html.create('table') | |||
root | |||
:addClass(self.options.class) | |||
:cssText(self.options.style) | |||
if self.options.caption then | |||
root | |||
:tag('caption') | |||
:wikitext(self.options.caption) | |||
end | |||
for _, obj in ipairs(self.templates) do | |||
-- Build the row HTML | |||
root | |||
:tag('tr') | |||
:tag('td') | |||
:css('text-align', 'center') | |||
:css('font-weight', 'bold') | |||
:wikitext(obj:makeHeading()) | |||
:done() | |||
:done() | |||
:tag('tr') | |||
:tag('td') | |||
:newline() | |||
:wikitext(self:getTemplateOutput(obj)) | |||
end | |||
return tostring(root) | return tostring(root) | ||
end | end |