4f5e507522073e3551b29482167172538a8abbdc.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <html>
  2. <head>
  3. <title>Test Transfer</title>
  4. <script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
  5. <script type="text/javascript">
  6. dojo.provide("dojox.wire.ml.tests.markup.Transfer");
  7. dojo.require("dojo.parser");
  8. dojo.require("doh.runner");
  9. dojo.require("dojox.data.dom");
  10. dojo.require("dojox.data.XmlStore");
  11. dojo.require("dojox.wire.ml.Action");
  12. dojo.require("dojox.wire.ml.Transfer");
  13. dojox.wire.ml.tests.markup.Transfer = {
  14. source: {a: "A", b: "B", c: [
  15. {d: "D1", e: "E1"},
  16. {d: "D2", e: "E2"}
  17. ]}
  18. };
  19. dojo.addOnLoad(function(){
  20. doh.register("dojox.wire.ml.tests.markup.Transfer", [
  21. function test_Transfer_attribute(t){
  22. dojox.wire.ml.tests.markup.Transfer.store = new dojox.data.XmlStore();
  23. dojox.wire.ml.tests.markup.Transfer.item = dojox.wire.ml.tests.markup.Transfer.store.newItem({tagName: "x"});
  24. dojox.wire.ml.tests.markup.Transfer.target = {};
  25. dojo.publish("transferData");
  26. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.a);
  27. },
  28. function test_Transfer_path(t){
  29. dojox.wire.ml.tests.markup.Transfer.element = dojox.data.dom.createDocument().createElement("x");
  30. dojox.wire.ml.tests.markup.Transfer.target = {};
  31. dojo.publish("transferXml");
  32. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.a);
  33. },
  34. function test_ChildWire(t){
  35. dojox.wire.ml.tests.markup.Transfer.target = {};
  36. dojo.publish("transferComposite");
  37. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.c);
  38. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.b, dojox.wire.ml.tests.markup.Transfer.target.d);
  39. },
  40. function test_ColumnWire(t){
  41. dojox.wire.ml.tests.markup.Transfer.target = {};
  42. dojo.publish("transferTable");
  43. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[0].d, dojox.wire.ml.tests.markup.Transfer.target.a[0].b);
  44. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[1].e, dojox.wire.ml.tests.markup.Transfer.target.a[1].c);
  45. },
  46. function test_NodeWire(t){
  47. dojox.wire.ml.tests.markup.Transfer.target = {};
  48. dojo.publish("transferTree");
  49. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[0].d, dojox.wire.ml.tests.markup.Transfer.target.a[0].title);
  50. t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[1].e, dojox.wire.ml.tests.markup.Transfer.target.a[1].children[0].title);
  51. },
  52. function test_SegimentWire(t){
  53. dojox.wire.ml.tests.markup.Transfer.target = {};
  54. dojo.publish("transferText");
  55. t.assertEqual("A/B", dojox.wire.ml.tests.markup.Transfer.target.c);
  56. }
  57. ]);
  58. doh.run();
  59. });
  60. </script>
  61. </head>
  62. <body>
  63. <div dojoType="dojox.wire.ml.Action"
  64. triggerTopic="transferData">
  65. <div dojoType="dojox.wire.ml.Transfer"
  66. source="dojox.wire.ml.tests.markup.Transfer.source.a"
  67. target="dojox.wire.ml.tests.markup.Transfer.item"
  68. targetStore="dojox.wire.ml.tests.markup.Transfer.store"
  69. targetAttribute="y"></div>
  70. <div dojoType="dojox.wire.ml.Transfer"
  71. source="dojox.wire.ml.tests.markup.Transfer.item"
  72. sourceStore="dojox.wire.ml.tests.markup.Transfer.store"
  73. sourceAttribute="y"
  74. target="dojox.wire.ml.tests.markup.Transfer.target.a"></div>
  75. </div>
  76. <div dojoType="dojox.wire.ml.Action"
  77. triggerTopic="transferXml">
  78. <div dojoType="dojox.wire.ml.Transfer"
  79. source="dojox.wire.ml.tests.markup.Transfer.source.a"
  80. target="dojox.wire.ml.tests.markup.Transfer.element"
  81. targetPath="y/text()"></div>
  82. <div dojoType="dojox.wire.ml.Transfer"
  83. source="dojox.wire.ml.tests.markup.Transfer.element"
  84. sourcePath="y/text()"
  85. target="dojox.wire.ml.tests.markup.Transfer.target.a"></div>
  86. <div dojoType="dojox.wire.ml.Transfer"
  87. source="dojox.wire.ml.tests.markup.Transfer.source.b"
  88. target="dojox.wire.ml.tests.markup.Transfer.element"
  89. targetPath="y/@z"></div>
  90. <div dojoType="dojox.wire.ml.Transfer"
  91. source="dojox.wire.ml.tests.markup.Transfer.element"
  92. sourcePath="y/@z"
  93. target="dojox.wire.ml.tests.markup.Transfer.target.b"></div>
  94. </div>
  95. <div dojoType="dojox.wire.ml.Transfer"
  96. triggerTopic="transferComposite"
  97. source="dojox.wire.ml.tests.markup.Transfer.source"
  98. target="dojox.wire.ml.tests.markup.Transfer.target">
  99. <div dojoType="dojox.wire.ml.ChildWire"
  100. name="x"
  101. property="a"></div>
  102. <div dojoType="dojox.wire.ml.ChildWire"
  103. which="source"
  104. name="y"
  105. property="b"></div>
  106. <div dojoType="dojox.wire.ml.ChildWire"
  107. which="target"
  108. name="x"
  109. property="c"></div>
  110. <div dojoType="dojox.wire.ml.ChildWire"
  111. which="target"
  112. name="y"
  113. property="d"></div>
  114. </div>
  115. <div dojoType="dojox.wire.ml.Transfer"
  116. triggerTopic="transferTable"
  117. source="dojox.wire.ml.tests.markup.Transfer.source.c"
  118. target="dojox.wire.ml.tests.markup.Transfer.target.a">
  119. <div dojoType="dojox.wire.ml.ColumnWire"
  120. column="b"
  121. property="d"></div>
  122. <div dojoType="dojox.wire.ml.ColumnWire"
  123. column="c"
  124. property="e"></div>
  125. </div>
  126. <div dojoType="dojox.wire.ml.Transfer"
  127. triggerTopic="transferTree"
  128. source="dojox.wire.ml.tests.markup.Transfer.source.c"
  129. target="dojox.wire.ml.tests.markup.Transfer.target.a">
  130. <div dojoType="dojox.wire.ml.NodeWire"
  131. titleProperty="d">
  132. <div dojoType="dojox.wire.ml.NodeWire"
  133. titleProperty="e"></div>
  134. </div>
  135. </div>
  136. <div dojoType="dojox.wire.ml.Transfer"
  137. triggerTopic="transferText"
  138. source="dojox.wire.ml.tests.markup.Transfer.source"
  139. delimiter="/"
  140. target="dojox.wire.ml.tests.markup.Transfer.target.c">
  141. <div dojoType="dojox.wire.ml.SegmentWire"
  142. property="a"></div>
  143. <div dojoType="dojox.wire.ml.SegmentWire"
  144. property="b"></div>
  145. </div>
  146. </body>
  147. </html>