Hi Folks,
ALPHA Warning! For advanced users only!
BACKUP - BACKUP - BACKUP ... Just to be sure I told you ;)
The trigger widget may be useful for RPG devs. Feedback very welcome.
I did create an interactive test framework, that lets me test all
tm-xxx messages [1] which are handled by the navigator-widget and its friends.
The reason is a proposal at github: "Proposal: make navigator.js + friends "multi - story" aware." [2]
Implementing
this proposal needs some code restructuring, which should be done
first. .. So changing the code, without new functionality. The tests
should be able to catch any problems. The goal is to have 0 errors ;)
The
second step should be new functionality, which will break the tests in a
"defined" way. ... So if something "undefined" happens, the tests
should be able to show such problems. ...
To achieve the functionality I did create a new plugin named: trigger
It
does trigger actions, whenever it is shown. ... So there is no need to
click a button to trigger the widget actions. It only needs to be
rendered. ...
This is very powerful and a
bit dangerous! .. It has the potential to brick your app. ... That's the
reason why, the linked edition uses "Next" and "Previous"
buttons.
eg:
close tiddler with current tiddler is a silly test, because it's hard
to edit it. So you should be able to recover from problems like this, if
you want to play with the "new toy". hint: If you run a node.js server, which creates single tiddlers, it's makes things easier. !!
It would be possible to run all tests in a view seconds automatically, but since it's ALPHA I don't want to do this yet :)
Running
tests in auto mode should _NOT_ be done with nodejs server. Especially
if you automatically create 10000+ tiddlers. It will need some seconds
in a single file wiki, but hours for the server to finish. ...
I did test it with FF70 and Windows 10. ... So it would be nice to get feedback, especially with different configurations.
-- Initial docs -----------------------------------
A "test" tiddler must be tagged: test
A test tiddler should look like: (without the blue text)
\define test(msg) <- macro that is called with trigger-widget
<$action-setfield $tiddler="$:/StoryList" $field=list $value={{!!title}}/> <- actions you want to happen
\end
\define text() Get Started <- Some log text
\import log-actions <- load utility macros
!! Info <- Info section should describe, what the test does and what should happen
* An interactive test framework
* This page, should give the user, the possibility to clear the log ;)
<$trigger actions=<<test>>/> <- trigger the actions defined at the top
<$set name="diff-count" value=0> <- set diff-count to 0
<$trigger actions=<<log>>/> <- add some info to the log tiddler
<$button actions=<<clear-log>> >Clear Log</$button> <- the log may be automatically deleted at the start
</$set>
* Only use the "Next" button. <- more info for the user
** "Previous" may cause errors, because the whole state may be out of sync
-------------
Differences can be logged like this:
''Differences indicate a problem!''
<$wikify name=xxx text="{{$:/StoryList||/templates/tid-tiddler}}"> <- variable that contains "the reality"
<$diff-text source=<<xxx>> dest={{StoryList-expected}}> <- compared to tiddler that contains the expected
{{$:/language/Diffs/CountMessage}}
<$trigger actions=<<log>>/> <- If there are differences log them
</$diff-text>
</$wikify>
have fun!
mario