Calculators/Form calculators/Tests


 * This is a page for testing MediaWiki:Common.js/calc.js.

article
This tests that search suggestions are enabled on article fields using FormCalcTests/article.

 template = Template:FormCalcTests/article form     = fct-article result   = fct-article-res suggestns = 0 param    = page|article (autocomplete)||article param    = page2|string (no autocomplete)||string

number
This tests that numbers outside a specific range are recorded as errors using FormCalcTests/number  template = Template:FormCalcTests/number form    = fct-number result  = fct-number-res param   = num|Number (out of range)|10|number|0-5.5 param   = num2|Number (within range)|3|number|0-5.4

int
This tests that integers outside a specific range and decimals are recorded as errors using FormCalcTests/int  template = Template:FormCalcTests/int form    = fct-int result  = fct-int-res param   = int|Int (out of range)|10|int|0-5 param   = int2|Int (within range)|3|int|0-5 param   = int3|Int (decimal)|4.2|int

select
This tests the select input with and without a default value using FormCalcTests/select  template = Template:FormCalcTests/select form    = fct-select result  = fct-select-res param   = select|Select (a-z)|f|select|a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z param   = select2|Select (a-z) (no default)||select|a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z

check
This tests the checkbox input for default and custom true-false values using FormCalcTests/check  template = Template:FormCalcTests/check form    = fct-check result  = fct-check-res param   = check|Check (true/false)||check param   = check2|Check (zero/one)||check|1,0

hs
This tests the hs parameter type using FormCalcTests/hs  template = Template:FormCalcTests/hs form     = fct-hs result   = fct-hs-res suggestns = 0 param    = hs|Player name||hs|attack,1,1;defence,2,1; param    = attack|Attack level|1|int param    = defence|Defence level|1|int

fixed
This tests the fixed parameter type using FormCalcTests/fixed  template = Template:FormCalcTests/fixed form     = fct-fixed result   = fct-fixed-res suggestns = 0 param    = fixed|Fixed|fixed|fixed param    = string|String|changeable|string

semihidden
This tests the semihidden input and custom true-false values using FormCalcTests/semihidden  template = Template:FormCalcTests/semihidden form    = fct-semihidden result  = fct-semihidden-res param   = semi|Semihidden (hidden)|hidden|semihidden param   = string|String (shown)|shown|string

To fully test this input:
 * Submit once to see the output as "hidden"
 * Paste the following js into your console:
 * Submit again and see the output as "changed

label html (div tag)
This tests label sanitisation using FormCalcTests/label template = Template:FormCalcTests/label form    = fct-label result  = fct-label-res param   = label|Random|A tag with href (wikitext)|fixed param   = label2|XSS|A tag with script URL (escaped)|fixed param   = label3| alert('xss weakness 2') |Script tag (escaped)|fixed param   = label4|testing ? |Text with additional span tag|fixed param   = label5| Font |Font tag (removed)|fixed

label html (pre tag)
This tests label sanitisation using FormCalcTests/label  template = Template:FormCalcTests/label form    = fct-label2 result  = fct-label2-res param   = label|Random|A tag with href|fixed param   = label2|XSS|A tag with script URL|fixed param   = label3| alert('xss weakness 2') |Script tag (removed)|fixed param   = label4|testing ? |Text with additional span tag|fixed param   = label5| Font |Font tag (removed)|fixed