Jump to content

Module:Template test case: Difference between revisions

add TestCase:makeCollapsible
(don't load libraryUtil as it is no longer used)
(add TestCase:makeCollapsible)
Line 213: Line 213:
end
end
return output
return output
end
function TestCase:makeCollapsible(s)
local isEqual = Template.outputEquals(unpack(self.templates))
local root = mw.html.create('table')
root
:addClass('collapsible')
:addClass(isEqual and 'collapsed' or nil)
:css('background-color', 'transparent')
:css('width', '100%')
:css('border', 'solid silver 1px')
:tag('tr')
:tag('th')
:css('background-color', isEqual and 'lightgreen' or 'yellow')
:wikitext(self.options.title or self.templates[1]:makeHeading())
:done()
:done()
:tag('tr')
:tag('td')
:wikitext(s)
return tostring(root)
end
end


Cookies help us deliver our services. By using our services, you agree to our use of cookies.