1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-07 18:39:57 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/widgets/TestCaseWidget.tid
jeremy@jermolene.com de9ea40179 Introduce testcase widget so that we can reuse testcases as documentation examples
There's still a bit to do: adding tabs to the source panel of the testcase display, and tweaking the CSS.
2023-04-10 16:25:01 +01:00

31 lines
1.2 KiB
Plaintext

caption: testcase
created: 20230406161341763
modified: 20230406161341763
tags: Widgets
title: TestCaseWidget
type: text/vnd.tiddlywiki
! Introduction
The testcase widget creates an independent subwiki loaded with specified tiddlers and then renders a template that can display and render tiddlers from within the subwiki. This makes it possible to run independent tests that also serve as documentation examples.
! Content and Attributes
The content of the `<$testcase>` widget is not displayed but instead is scanned for <<.wlink DataWidget>> widgets that define tiddlers to be included in the test case.
|!Attribute |!Description |
|<<.attr testcase-tiddler>> |Optional title of a tiddler containing a test case in `text/vnd.tiddlywiki-multiple` format (see below) |
|<<.attr template>> |Optional title of the template used to display the testcase (defaults to $:/core/ui/testcases/DefaultTemplate) |
! Example
<$testcase>
<$data $tiddler="$:/core"/>
<$data title="Description" text="Simple example of a test case"/>
<$data title="Output" text="""<$testcase>
<$data title="Description" text="How to calculate 2 plus 2"/>
<$data title="Output" text="<$text text={{{ =2 =[add[2]] }}}/>"/>
</$testcase>
"""/>
</$testcase>