Jump to content

Module:Sandbox/SD0001/Calculator/testcases

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by SD0001 (talk | contribs) at 16:00, 30 January 2025 (samples). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local Calculator = require('Module:Sandbox/SD0001/Calculator')

return {
	main = function (frame)
		local calc = Calculator:new()
		
		calc:codexLabel {
			description = 'Short description text',
			label = 'Label text',
			['for'] = 'foo'
		}
		calc:codexText {
			default = 42,
			id = 'foo'
		}
		
		-- {{Calculator codex radio|id=myradio|name=group1|label=First option|description=Additional text describing the first option}}
	
		calc:codexRadio {
			id = 'myradio',
			name = 'group1',
			label = 'First option',
			description = 'Additional text describing the first option'
		}
		
		-- {{Calculator label|codex=true|description=Short description text|label=Label text|for=foo}}
		-- {{calculator codex text|default=42|id=foo}}
	
		calc:codexCheckbox {
			id = 'mycheck',
			name = 'group1',
			label = 'First option',
			description = 'Additional text describing the first option'
		}
		
		-- {{Calculator codex toggle|id=mycheck|label=My toggle|description=Additional text describing the toggle}}
	
		calc:codexToggle {
			id = 'mycheck',
			label = 'My toggle',
			description = 'Additional text describing the toggle'
		}
		
		return tostring(calc)
	end
}