1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-21 11:49:44 +00:00
TiddlyWiki5/core/ui/TestCases/DefaultTemplate.tid

149 lines
3.5 KiB
Plaintext
Raw Normal View History

Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
title: $:/core/ui/testcases/DefaultTemplate
code-body: yes
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
\whitespace trim
\function tf.state() "$:/state/testcase"
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
\procedure linkcatcherActions()
<%if [<navigateTo>has[title]] %>
<$action-setfield $tiddler=<<tf.state>> text=<<navigateTo>>/>
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
<%endif%>
\end
\procedure testcase-header()
<div class="tc-test-case-header">
<h2>
<$genesis $type={{{ [<linkTarget>!match[]then[$link]else[span]] }}} to=<<testcaseTiddler>>>
<%if [<testResult>!match[]] %>
<span class={{{ tc-test-case-result-icon
[<testResult>!match[fail]then[tc-test-case-result-icon-pass]]
[<testResult>match[fail]then[tc-test-case-result-icon-fail]]
+[join[ ]] }}}
>
<%if [<testResult>!match[fail]] %>
{{$:/core/images/done-button}}
<%else%>
{{$:/core/images/close-button}}
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
<%endif%>
</span>
<%endif%>
<$view tiddler="Description" mode="inline"/>
</$genesis>
<span class="tc-test-case-toolbar">
<<testcase-toolbar>>
</span>
</h2>
</div>
\end
\procedure testcase-toolbar()
<$button popup=`$(tf.state)$-more`
tooltip={{$:/language/Buttons/More/Hint}}
aria-label={{$:/language/Buttons/More/Caption}}
class="tc-btn-invisible"
selectedClass="tc-selected"
>
{{$:/core/images/down-arrow}}
</$button>
<$let
tv-config-toolbar-icons="yes"
tv-config-toolbar-text="yes"
tv-config-toolbar-class="tc-btn-invisible"
>
<$reveal state=`$(tf.state)$-more` type="popup" position="belowleft" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]"
variable="listItem"
>
<$transclude $tiddler=<<listItem>> $mode="inline"/>
</$list>
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
</div>
</$reveal>
Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging
2024-05-20 10:30:30 +00:00
</$let>
\end
\procedure testcase-narrative()
<div class="tc-test-case-narrative">
<$transclude $tiddler="Narrative" $mode="block"/>
</div>
\end
\procedure testcase-fail()
<div class="tc-test-case-result-fail">
<div class="tc-test-case-result-fail-header">
TEST FAILED
</div>
<div class="tc-test-case-result-fail-body">
<$diff-text source=<<expectedHTML>> dest=<<outputHTML>>/>
</div>
</div>
\end
\procedure testcase-output-wikified()
<$linkcatcher actions=<<linkcatcherActions>>>
<$tiddler tiddler="Output">
<$transclude $tiddler="Output" $mode="block"/>
</$tiddler>
</$linkcatcher>
\end
\procedure testcase-output()
<div class="tc-test-case-output">
<%if [<displayFormat>!match[]else[wikitext]match[plaintext]] %>
<pre><$view tiddler="Output" format="plainwikified" mode="block"/></pre>
<%else%>
<<testcase-output-wikified>>
<%endif%>
</div>
\end
\procedure testcase-tabsList()
[all[tiddlers]sort[]] Output +[putfirst[]]
-Description
-Narrative
-[[$:/temp/testcase/draft-title]]
-[has[plugin-type]]
-[prefix<tf.state>]
-[prefix[$:/state/popup/export]]
-[prefix[$:/HistoryList]]
-[prefix[$:/StoryList]]
\end
\procedure testcase-source()
<div class="tc-test-case-source">
<$macrocall $name="tabs"
tabsList=<<testcase-tabsList>>
explicitState=<<tf.state>>
default="Output"
template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"
/>
</div>
\end
\procedure testcase-panes()
<div class="tc-test-case-panes">
<<testcase-source>>
<div class="tc-test-case-divider"></div>
<<testcase-output>>
</div>
\end
\procedure testcase-body()
<div class="tc-test-case-wrapper">
<<testcase-header>>
<$let testcase-source-state = <<tf.state>>>
<$navigator story="$:/StoryList" history="$:/HistoryList">
<%if [[Narrative]is[tiddler]] %>
<<testcase-narrative>>
<%endif%>
<%if [<testResult>match[fail]] %>
<<testcase-fail>>
<%endif%>
<<testcase-panes>>
</$navigator>
</$let>
</div>
\end
<<testcase-body>>