Module:Template test case: Difference between revisions

    (fix function name)
    (add TestCase:renderInline and add newlines between the render output when making collapsible test cases)
    Line 148: Line 148:
    columns = 'renderColumns',
    columns = 'renderColumns',
    rows = 'renderRows',
    rows = 'renderRows',
    inline = 'renderInline',
    default = 'renderDefault'
    default = 'renderDefault'
    }
    }
    Line 276: Line 277:
    :tag('tr')
    :tag('tr')
    :tag('td')
    :tag('td')
    :newline()
    :wikitext(s)
    :wikitext(s)
    :newline()
    return tostring(root)
    return tostring(root)
    end
    end
    Line 370: Line 373:


    return tostring(root)
    return tostring(root)
    end
    function TestCase:renderInline()
    local arrow = mw.language.getContentLanguage():getArrow('forwards')
    local ret = {}
    for i, obj in ipairs(self.templates) do
    local line = {}
    line[#line + 1] = ': '
    if self.options.showcode then
    line[#line + 1] = obj:getInvocation('code')
    line[#line + 1] = ' '
    line[#line + 1] = arrow
    line[#line + 1] = ' '
    end
    line[#line + 1] = self:getTemplateOutput(obj)
    ret[#ret + 1] = table.concat(line)
    end
    return table.concat(ret, '\n')
    end
    end