Jump to content

Module:List/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 13:48, 24 November 2013 (create tests for the bulleted function). 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:List]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_bulleted()
    self:preprocess_equals_many('{{#invoke:List|bulleted', '}}', {
		{'', ''},
		{'|foo', '<div><ul><li>foo</li></ul></div>'},
		{'|foo|bar', '<div><ul><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|class=plainlinks', '<div class="plainlinks"><ul><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|style=font-weight: bold', '<div style="font-weight: bold;"><ul><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|list_style=font-weight: bold', '<div><ul style="font-weight: bold;"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|item_style=font-weight: bold', '<div><ul><li style="font-weight: bold;">foo</li><li style="font-weight: bold;">bar</li></ul></div>'},
		{'|foo|bar|item_style1=font-weight: bold', '<div><ul><li style="font-weight: bold;">foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|item_style2=font-weight: bold', '<div><ul><li>foo</li><li style="font-weight: bold;">bar</li></ul></div>'},
		{'|foo|bar|ul_style=font-weight: bold', '<div><ul style="font-weight: bold;"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|ol_style=font-weight: bold', '<div><ul style="font-weight: bold;"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|li_style=font-weight: bold', '<div><ul><li style="font-weight: bold;">foo</li><li style="font-weight: bold;">bar</li></ul></div>'},
		{'|foo|bar|li_style1=font-weight: bold', '<div><ul><li style="font-weight: bold;">foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|li_style2=font-weight: bold', '<div><ul><li>foo</li><li style="font-weight: bold;">bar</li></ul></div>'},
		{'|foo|bar|type=i', '<div><ul type="i"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|list_style_type=lower-greek', '<div><ul style="list-style-type:lower-greek;"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|start=2', '<div><ul start="2"><li>foo</li><li>bar</li></ul></div>'},
		{'|foo|bar|indent=2', '<div><ul><li>foo</li><li>bar</li></ul></div>'},
	})
end

return p