test452.txml 930 B

123456789101112131415161718192021222324252627
  1. <!-- test that we can assign to any location in the datamodel. In this case, we just test that we can assign
  2. to a substructure (not the top level variable). This may not be the most idiomatic way to write the test -->
  3. <scxml datamodel="ecmascript" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance">
  4. <datamodel>
  5. <data id="foo" expr="0"/>
  6. </datamodel>
  7. <script>
  8. function testobject() {
  9. this.bar = 0;}
  10. </script>
  11. <state id="s0">
  12. <onentry>
  13. <assign location="foo" expr="new testobject();"/>
  14. <!-- try to assign to foo's bar property -->
  15. <assign location="foo.bar" expr="1"/>
  16. <raise event="event1"/>
  17. </onentry>
  18. <!-- test that we have assigned to foo's bar property -->
  19. <transition event="event1" cond="foo.bar == 1" conf:targetpass=""/>
  20. <transition event="*" conf:targetfail=""/>
  21. </state>
  22. <conf:pass/>
  23. <conf:fail/>
  24. </scxml>