From f8ce842d26ed2ce191ec2c0ba948da9bbde3aa7f Mon Sep 17 00:00:00 2001 From: pmario Date: Sat, 3 Aug 2024 16:25:37 +0200 Subject: [PATCH] Make testcase tab-view a story-river --- core/ui/TestCases/DefaultTemplate.tid | 214 +++++++++++------- .../DefaultTemplateSourceTabsNEW.tid | 50 ++++ core/wiki/macros/toc.tid | 2 +- .../Examples_TOC_SimpleToc_parentField.tid | 3 +- 4 files changed, 184 insertions(+), 85 deletions(-) create mode 100644 core/ui/TestCases/DefaultTemplateSourceTabsNEW.tid diff --git a/core/ui/TestCases/DefaultTemplate.tid b/core/ui/TestCases/DefaultTemplate.tid index 6b6578c34..df0b64422 100644 --- a/core/ui/TestCases/DefaultTemplate.tid +++ b/core/ui/TestCases/DefaultTemplate.tid @@ -2,94 +2,142 @@ title: $:/core/ui/testcases/DefaultTemplate code-body: yes \whitespace trim -\procedure linkcatcherActions() -<$action-log/> -<%if [has[title]] %> - <$qualify title=<> name="qualifiedState"> - <$action-setfield $tiddler=<> text=<>/> - -<%endif%> + +\function tf.state() [] + +\procedure textcase-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}} + +<$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"> +
+ <$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]" + variable="listItem" + > + <$transclude $tiddler=<> $mode="inline"/> + +
+ + \end -<$navigator story={{{ [] }}} history={{{ [] }}}> -<$let - state={{{ [] }}} -> - <$linkcatcher actions=<>> -
-
-

- <$genesis $type={{{ [!match[]then[$link]else[span]] }}} to=<>> - <%if [!match[]] %> - !match[fail]then[tc-test-case-result-icon-pass]] [match[fail]then[tc-test-case-result-icon-fail]] +[join[ ]] }}}> - <%if [!match[fail]] %> - {{$:/core/images/done-button}} - <%else%> - {{$:/core/images/close-button}} - <%endif%> - - <%endif%> - <$view tiddler="Description" mode="inline"/> - - - <$button popup=`$(state)$-more` - tooltip={{$:/language/Buttons/More/Hint}} - aria-label={{$:/language/Buttons/More/Caption}} - class="tc-btn-invisible" - selectedClass="tc-selected" - > - {{$:/core/images/down-arrow}} - - <$let - tv-config-toolbar-icons="yes" - tv-config-toolbar-text="yes" - tv-config-toolbar-class="tc-btn-invisible" - > - <$reveal state=`$(state)$-more` type="popup" position="belowleft" animate="yes"> -
- <$list filter="[all[shadows+tiddlers]tag[$:/tags/TestCase/Actions]!has[draft.of]]" - variable="listItem" - > - <$transclude $tiddler=<> $mode="inline"/> - -
- - -
-

-
- <%if [[Narrative]is[tiddler]] %> -
- <$transclude $tiddler="Narrative" $mode="block"/> -
- <%endif%> - <%if [match[fail]] %> -
-
- TEST FAILED -
-
- <$diff-text source=<> dest=<>/> -
-
- <%endif%> -
-
- <$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] Output +[putfirst[]] -[prefix] -[prefix[$:/HistoryList]] -[prefix[$:/StoryList]] -Description -Narrative -[has[plugin-type]]" state=<> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/> -
-
-
-
- <%if [!match[]else[wikitext]match[plaintext]] %> -
<$view tiddler="Output" format="plainwikified" mode="block"/>
+\procedure testcase-header() +
+

+ <$genesis $type={{{ [!match[]then[$link]else[span]] }}} to=<>> + <%if [!match[]] %> + !match[fail]then[tc-test-case-result-icon-pass]] [match[fail]then[tc-test-case-result-icon-fail]] +[join[ ]] }}}> + <%if [!match[fail]] %> + {{$:/core/images/done-button}} <%else%> - <$tiddler tiddler="Output"> - <$transclude $tiddler="Output" $mode="block"/> - + {{$:/core/images/close-button}} <%endif%> + + <%endif%> + <$view tiddler="Description" mode="inline"/> + + + <> + +

+
+\end + +\procedure testcase-narrative() +
+ <$transclude $tiddler="Narrative" $mode="block"/> +
+\end + +\procedure testcase-fail() +
+
+ TEST FAILED +
+
+ <$diff-text source=<> dest=<>/> +
+
+\end + +\procedure testcase-output() +
+ <%if [!match[]else[wikitext]match[plaintext]] %> +
<$view tiddler="Output" format="plainwikified" mode="block"/>
+ <%else%> + <$tiddler tiddler="Output"> + <$transclude $tiddler="Output" $mode="block"/> + + <%endif%> +
+\end + +\procedure testcase-body() +
+ <> + <%if [[Narrative]is[tiddler]] %> + <> + <%endif%> + <%if [match[fail]] %> + <> + <%endif%> +
+
+ <$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix] -[prefix[$:/HistoryList]] -[prefix[$:/StoryList]] -[[$:/temp/testcase/draft-title]] -Description -Narrative -Output Output +[putfirst[]] -[has[plugin-type]]" state=<> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/> + +
] }}}> +
] }}}> + <$list filter="[all[tiddlers]sort[]] Output +[putfirst[]] -[prefix] -[prefix[$:/HistoryList]] -[prefix[$:/StoryList]] -[[$:/temp/testcase/draft-title]] -Description -Narrative -[has[plugin-type]]" + variable="currentTab" + storyview="pop" + > + <$set name="save-currentTiddler" + value=<> + > + <$tiddler tiddler=<>> + <$button + to=<> + class={{{ [{$:/HistoryList!!current-tiddler}!is[blank]] :then[{$:/HistoryList!!current-tiddler}matchthen[tc-tab-selected]else[]] :else[match[Output]then[tc-tab-selected]else[]] }}} + tooltip={{{[get[tooltip]]}}} + role="switch" + data-tab-title=<> + > + <$tiddler tiddler=<>> + <$set name="tv-wikilinks" value="no"> + <$transclude tiddler=<> mode="inline"> + <$transclude tiddler=<> field="caption"> + <$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/> + + + + + + + +
+
+
+ {{||$:/core/ui/testcases/DefaultTemplate/SourceTabsNEW}} +
- - +
+ <> +
+
+\end + +<$navigator story="$:/StoryList" history="$:/HistoryList"> +<> \ No newline at end of file diff --git a/core/ui/TestCases/DefaultTemplateSourceTabsNEW.tid b/core/ui/TestCases/DefaultTemplateSourceTabsNEW.tid new file mode 100644 index 000000000..856b691b4 --- /dev/null +++ b/core/ui/TestCases/DefaultTemplateSourceTabsNEW.tid @@ -0,0 +1,50 @@ +title: $:/core/ui/testcases/DefaultTemplate/SourceTabsNEW + +\whitespace trim + +\procedure testcaseNewTitle() $:/temp/testcase/draft-title + +\procedure saveActions() +<$action-setfield $tiddler=<> $field="draft.title" $value={{{ [get[text]] }}}/> +<$action-sendmessage $message="tm-save-tiddler" $param=<> /> +<$action-navigate $to=<<navTitle>> $scroll="no"/> +<$action-deletetiddler $tiddler=<<testcaseNewTitle>>/> +\end + +\procedure saveButton(title, navTitle) +<$button class="tc-btn-invisible tc-test-case-save-button tc-small-gap-left" actions=<<saveActions>> disabled={{{ [<testcaseNewTitle>!has[text]then[yes]] }}}> +{{$:/core/images/done-button}} +</$button> +\end + +\procedure body() +<$list filter="[<currentTab>fields[]] -text +[limit[1]]" variable="ignore" > + <table class="tc-field-table"> + <tbody> + <$list filter="[<currentTab>fields[]sort[]] -text -title title +[putfirst[]]" variable="fieldName"> + <tr> + <td> + <$text text=<<fieldName>>/> + </td> + <td> + <%if [<fieldName>match[draft.title]] %> + <$edit-text class="tc-edit-texteditor tc-max-width-80" tiddler=<<testcaseNewTitle>> focus="yes" tag="input"/> + <$macrocall $name="saveButton" navTitle={{{ [<currentTab>get[draft.title]] }}} title=<<currentTab>>/> + <%else%> + <$view tiddler=<<currentTab>> field=<<fieldName>>/> + <%endif%> + </td> + </tr> + </$list> + </tbody> + </table> +</$list> +<$edit class="tc-edit-texteditor" tiddler=<<currentTab>>/> +<div class="tc-test-case-footer-toolbar"> +<$macrocall $name="copy-to-clipboard" src={{{ [<currentTab>get[text]] }}}/> +</div> +\end + +<$let currentTab={{{ [{$:/HistoryList!!current-tiddler}!is[blank]else[Output]] }}}> +<$transclude $variable="body" $mode="inline"/> +</$let> \ No newline at end of file diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index a808f57d0..dd563d760 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -55,7 +55,7 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc {{$:/core/images/new-here-button}} <% endif %> <!-- Allows the toc macros to navigate in test-case tiddlers --> - <$action-navigate $to={{{ [<tv-history-list>get[current-tiddler]] }}}/> + <!-- <$action-navigate $to={{{ [<tv-history-list>get[current-tiddler]] }}}/> --> </$button> \end _newChild <% if [<tv-toc-show-new-child>match[yes]] %> diff --git a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid b/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid index 17dfeb56d..13e904b6c 100644 --- a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid +++ b/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid @@ -1,6 +1,6 @@ created: 20240730081443212 description: Simple TOC - parentField parameter -modified: 20240730115536164 +modified: 20240803121600331 tags: $:/tags/wiki-test-spec title: Examples/TOC/SimpleToc/parentField type: text/vnd.tiddlywiki-multiple @@ -18,6 +18,7 @@ title: root The parent-field in the ''child''-tiddlers are used to define the relation to the parent tiddler + title: Child-1 +tooltip: child-1 tooltip parent: root 1st 1st 1st 1st 1st