Template:Test case/doc

From Albion Online Wiki
Jump to navigation Jump to search

Template:Template This template is used to illustrate the proper (and maybe improper) usage of a template and its parameters on the template's Template:Path subpage. It is a replacement for the {{Testcase}} template that avoids table wiki markup. (Illustrating template usage inside a table is problematic because the pipe character, ||, tends to get interpreted as table markup in that context.)

If used to show incorrect usage, it's probably a good idea to collect those cases under a section heading like ===Incorrect===. (See, for example, the documentation of Template:Tlm.)

Parameters

Parameter name Required? Default value Description
title Yes (n/a) Brief description of the testcase (e.g., "One anonymous parameter")
Anonymous parameter 1 Yes (n/a) Example wikicode (template call) inside a Template:Htc element.
Anonymous parameter 2 Yes (n/a) Same wikicode without Template:Htc.
Anonymous parameter 3 Yes (n/a) Same wikicode without Template:Htc, using "/sandbox" after the template name.
error No (n/a) Describes the error being illustrated in a test case showing incorrect usage.
code No (n/a) Can be set to Template:Tp to allow for multiline examples.
background-color No (n/a) Background color in the title bar (default explained below).
text-color No white Text color in the title bar.

While omitting the third anonymous parameter does not give an error, it would not allow editors to see how the sandbox version of the template compares to the main version. Please use all three parameters, even if there is currently no sandbox version of the template being documented.

The default value of Template:Tp is usually Template:Tp, which matches the purple color scheme used throughout the wiki). However, if the parameter Template:Tp is set to any string, then the default background color is Template:Tp, a purplish black, as seen in the testcases below.

The value of Template:Tp is displayed in parentheses after Template:Tp in the title bar, so it should be descriptive (not, for example, the word Template:Tp). If you have no better description of the error being illustrated, you can just use, for example, Template:Tp.

Template:Note

Usage

Typical:

{{Test case
|title=Descriptive title
|<nowiki>{{Template call}}</nowiki>
|        {{Template call}}
|{{Template/sandbox call}}
}}
{{Test case
|title=Descriptive title
|error=Brief description of error
|<nowiki>{{Template call}}</nowiki>
|        {{Template call}}
|{{Template/sandbox call}}
}}

All parameters:

{{Test case
|title=
|error=
|code=pre
|background-color=
|text-color=
|<nowiki>{{}}</nowiki>
|        {{}}
|{{/sandbox}}
}}

See the template's testcases: Template:Test case/testcases

See also