1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-10 20:09:57 +00:00

Testcase widget improve containment (#8529)

* testcase improve containment using navigator-widget

* testcase implement minimal edit new-tiddler interface
This commit is contained in:
Mario Pietsch 2024-08-20 17:29:16 +02:00 committed by GitHub
parent f10d4eb58d
commit b75fa58746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 9 deletions

View File

@ -3,7 +3,7 @@ code-body: yes
\whitespace trim \whitespace trim
\function tf.state() [<qualify "$:/state/testcase">] \function tf.state() "$:/state/testcase"
\procedure linkcatcherActions() \procedure linkcatcherActions()
<%if [<navigateTo>has[title]] %> <%if [<navigateTo>has[title]] %>
@ -102,9 +102,12 @@ code-body: yes
[all[tiddlers]sort[]] Output +[putfirst[]] [all[tiddlers]sort[]] Output +[putfirst[]]
-Description -Description
-Narrative -Narrative
-[[$:/temp/testcase/draft-title]]
-[has[plugin-type]] -[has[plugin-type]]
-[prefix<tf.state>] -[prefix<tf.state>]
-[prefix[$:/state/popup/export]] -[prefix[$:/state/popup/export]]
-[prefix[$:/HistoryList]]
-[prefix[$:/StoryList]]
\end \end
\procedure testcase-source() \procedure testcase-source()
@ -129,13 +132,17 @@ code-body: yes
\procedure testcase-body() \procedure testcase-body()
<div class="tc-test-case-wrapper"> <div class="tc-test-case-wrapper">
<<testcase-header>> <<testcase-header>>
<%if [[Narrative]is[tiddler]] %> <$let testcase-source-state = <<tf.state>>>
<<testcase-narrative>> <$navigator story="$:/StoryList" history="$:/HistoryList">
<%endif%> <%if [[Narrative]is[tiddler]] %>
<%if [<testResult>match[fail]] %> <<testcase-narrative>>
<<testcase-fail>> <%endif%>
<%endif%> <%if [<testResult>match[fail]] %>
<<testcase-panes>> <<testcase-fail>>
<%endif%>
<<testcase-panes>>
</$navigator>
</$let>
</div> </div>
\end \end

View File

@ -1,6 +1,22 @@
title: $:/core/ui/testcases/DefaultTemplate/SourceTabs title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
\whitespace trim \whitespace trim
\procedure testcaseNewTitle() $:/temp/testcase/draft-title
\procedure saveActions()
<$action-setfield $tiddler=<<currentTab>> $field="draft.title" $value=<<newTitle>>/>
<$action-sendmessage $message="tm-save-tiddler" $param=<<title>> />
<$action-setfield $tiddler=<<testcase-source-state>> text=<<newTitle>>/>
<$action-deletetiddler $tiddler=<<testcaseNewTitle>>/>
\end
\procedure saveButton(title, newTitle)
<$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() \procedure body()
<$list filter="[<currentTab>fields[]] -text +[limit[1]]" variable="ignore"> <$list filter="[<currentTab>fields[]] -text +[limit[1]]" variable="ignore">
<table class="tc-field-table"> <table class="tc-field-table">
@ -11,7 +27,12 @@ title: $:/core/ui/testcases/DefaultTemplate/SourceTabs
<$text text=<<fieldName>>/> <$text text=<<fieldName>>/>
</td> </td>
<td> <td>
<$view tiddler=<<currentTab>> field=<<fieldName>>/> <%if [<fieldName>match[draft.title]] %>
<$edit-text class="tc-edit-texteditor tc-max-width-80" tiddler=<<testcaseNewTitle>> focus="yes" tag="input"/>
<$macrocall $name="saveButton" newTitle={{{ [<testcaseNewTitle>get[text]] }}} title=<<currentTab>>/>
<%else%>
<$view tiddler=<<currentTab>> field=<<fieldName>>/>
<%endif%>
</td> </td>
</tr> </tr>
</$list> </$list>