Jump to content

Template:Right sidenote/sandbox/CSSline/testcases

From Wikisource

"The CSSline template generates a properly formed and terminated CSS attribute (property and value) pair, if and only if an actual user supplied value is present and not the same as default value (which will have been specified in a Templatestyle elsewhere.)

The inputs to the CSSline template are :-

   The CSS property to genrate.
   The user supplied value the property should have (value).
   The default value for the property concerned. 

The output of the CSSline template shall be :-

   A correctly separated and terminated, CSS attribute (property and value pair), if and only if the user supplied value is present, and is neither
       the nil or empty string, nor
       the value '@std' ,nor
       identical to the provided 'default' value
   'empty' if no user supplied value is provided.
   'empty' if a 'nil' or empty string is provided for the user supplied value.
   'empty' if a value of @std is given for the user supplied value ( implying use of the standard or default value).
   'empty' if the user supplied value, is the same (or expands to the same as) the default value. (NB It seems I had not yet fully coded this..)

"

Testing main template

[edit]
Call Result Expected
{{Right sidenote/sandbox/CSSline|font-size|81%|83%}} font-size:81%; font-size:81%;
{{Right sidenote/sandbox/CSSline|font-size|83%|83%}} empty
{{Right sidenote/sandbox/CSSline|font-size|@std|83%}} font-size:@std; empty
{{Right sidenote/sandbox/CSSline|font-size||83%}} empty
{{Right sidenote/sandbox/CSSline|font-size|{{{value|@std}}}|83%}} font-size:@std; empty
{{Right sidenote/sandbox/CSSline|font-size|{{{value|}}}|83%}} font-size:@std; empty
{{Right sidenote/sandbox/CSSline|font-size|{{{value|90%}}}|83%}} font-size:90%; font-size:90%;
{{Right sidenote/sandbox/CSSline|font-size|{{{value|83%}}}|83%}} empty
{{User:ShakespeareFan00/foo1|value=}} to test handling of {{Right sidenote/sandbox/CSSline|font-size|{{{value|90%}}}|83%}} font-size:90%; font-size:90%;