diff options
Diffstat (limited to 'test/uscxml/history-stacks')
-rw-r--r-- | test/uscxml/history-stacks/history-compounds.scxml | 53 | ||||
-rw-r--r-- | test/uscxml/history-stacks/history-invokers.item.scxml | 30 | ||||
-rw-r--r-- | test/uscxml/history-stacks/history-invokers.main.scxml | 24 |
3 files changed, 107 insertions, 0 deletions
diff --git a/test/uscxml/history-stacks/history-compounds.scxml b/test/uscxml/history-stacks/history-compounds.scxml new file mode 100644 index 0000000..0fbca92 --- /dev/null +++ b/test/uscxml/history-stacks/history-compounds.scxml @@ -0,0 +1,53 @@ +<scxml datamodel="ecmascript"> + <datamodel> + <data id="stack">[]</data> + </datamodel> + + <initial> + <transition target="main"> + <send event="to.item1" /> + <send event="to.item2" /> + <send event="to.item1" /> + <send event="back" /> + <send event="back" /> + <send event="back" /> + </transition> + </initial> + + <parallel id="main"> + <state id="controller"> + <transition event="to.item1" + target="item1.history"> + <script>stack.push("item1");</script> + </transition> + <transition event="to.item2" + target="item2.history"> + <script>stack.push("item2");</script> + </transition> + + <transition event="back" + cond="stack[stack.length-1] === 'item1'" + target="item1"> + <script>stack.pop();</script> + </transition> + <transition event="back" + cond="stack[stack.length-1] === 'item2'" + target="item2"> + <script>stack.pop();</script> + </transition> + </state> + + <state id="items"> + <state id="item1"> + <history type="deep" + id="item1.history" /> + <!-- interaction would be established here --> + </state> + <state id="item2"> + <history type="deep" + id="item2.history" /> + <!-- interaction would be established here --> + </state> + </state> + </parallel> +</scxml>
\ No newline at end of file diff --git a/test/uscxml/history-stacks/history-invokers.item.scxml b/test/uscxml/history-stacks/history-invokers.item.scxml new file mode 100644 index 0000000..30f1a02 --- /dev/null +++ b/test/uscxml/history-stacks/history-invokers.item.scxml @@ -0,0 +1,30 @@ +<scxml datamodel="ecmascript"> + <datamodel> + <data id="item" /> + <data id="childItem" /> + </datamodel> + + <state> + + <state id="show"> + <!-- interaction would be established here --> + <transition event="to.item1" target="down"> + <assign location="childItem" expr="1" /> + </transition> + <transition event="to.item2" target="down"> + <assign location="childItem" expr="2" /> + </transition> + <transition event="back" target="done" /> + </state> + + <state id="down"> + <invoke src="history-invokers.item.scxml" + autoforward="true"> + <param name="item" expr="childItem" /> + </invoke> + </state> + <transition event="done.invoke" target="show" /> + </state> + + <final id="done" /> +</scxml>
\ No newline at end of file diff --git a/test/uscxml/history-stacks/history-invokers.main.scxml b/test/uscxml/history-stacks/history-invokers.main.scxml new file mode 100644 index 0000000..eec3e79 --- /dev/null +++ b/test/uscxml/history-stacks/history-invokers.main.scxml @@ -0,0 +1,24 @@ +<scxml datamodel="ecmascript"> + <initial> + <transition target="main"> + <send event="to.item1" /> + <send event="to.item2" /> + <send event="to.item1" /> + <send event="back" delay="200ms"/> + <send event="back" delay="300ms"/> + <send event="back" delay="400ms"/> + <!-- terminate 'main' as well --> + <send event="back" delay="500ms"/> + </transition> + </initial> + + <state id="main"> + <invoke src="history-invokers.item.scxml" + autoforward="true"> + <param name="item" expr="'main'" /> + </invoke> + <transition event="done.invoke" + target="done" /> + </state> + <final id="done" /> +</scxml>
\ No newline at end of file |