aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/wire/tests
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/wire/tests')
-rw-r--r--includes/js/dojox/wire/tests/markup/Action.html147
-rw-r--r--includes/js/dojox/wire/tests/markup/Data.html105
-rw-r--r--includes/js/dojox/wire/tests/markup/DataStore.html66
-rw-r--r--includes/js/dojox/wire/tests/markup/DataStore.xml18
-rw-r--r--includes/js/dojox/wire/tests/markup/Invocation.html53
-rw-r--r--includes/js/dojox/wire/tests/markup/Service.html84
-rw-r--r--includes/js/dojox/wire/tests/markup/Service/JSON.smd11
-rw-r--r--includes/js/dojox/wire/tests/markup/Service/XML.smd11
-rw-r--r--includes/js/dojox/wire/tests/markup/Service/a.json5
-rw-r--r--includes/js/dojox/wire/tests/markup/Service/a.xml5
-rw-r--r--includes/js/dojox/wire/tests/markup/Transfer.html157
-rw-r--r--includes/js/dojox/wire/tests/module.js13
-rw-r--r--includes/js/dojox/wire/tests/programmatic/CompositeWire.js51
-rw-r--r--includes/js/dojox/wire/tests/programmatic/ConverterDynamic.js12
-rw-r--r--includes/js/dojox/wire/tests/programmatic/DataWire.js25
-rw-r--r--includes/js/dojox/wire/tests/programmatic/TableAdapter.js24
-rw-r--r--includes/js/dojox/wire/tests/programmatic/TextAdapter.js25
-rw-r--r--includes/js/dojox/wire/tests/programmatic/TreeAdapter.js29
-rw-r--r--includes/js/dojox/wire/tests/programmatic/Wire.js123
-rw-r--r--includes/js/dojox/wire/tests/programmatic/XmlWire.js32
-rw-r--r--includes/js/dojox/wire/tests/programmatic/_base.js111
-rw-r--r--includes/js/dojox/wire/tests/runTests.html9
-rw-r--r--includes/js/dojox/wire/tests/wire.js18
-rw-r--r--includes/js/dojox/wire/tests/wireml.js18
24 files changed, 1152 insertions, 0 deletions
diff --git a/includes/js/dojox/wire/tests/markup/Action.html b/includes/js/dojox/wire/tests/markup/Action.html
new file mode 100644
index 0000000..75cbd49
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Action.html
@@ -0,0 +1,147 @@
+<html>
+<head>
+<title>Test Action</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.Action");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.wire.ml.Action");
+dojo.require("dojox.wire.ml.Transfer");
+
+dojox.wire.ml.tests.markup.Action = {
+ transfer: function(){},
+ source: {a: "A", b: "B"}
+};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.Action", [
+ function test_Action_triggerEvent(t){
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojox.wire.ml.tests.markup.Action.transfer();
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.b, dojox.wire.ml.tests.markup.Action.target.b);
+ },
+
+ function test_Action_triggerTopic(t){
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojo.publish("transfer");
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ },
+
+ function test_ActionFilter_required(t){
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojo.publish("transferFilter");
+ t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
+ t.assertEqual("no required", dojox.wire.ml.tests.markup.Action.error);
+ dojox.wire.ml.tests.markup.Action.required = true;
+ dojo.publish("transferFilter");
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ },
+
+ function test_ActionFilter_requiredSpecificNumber(t){
+ dojox.wire.ml.tests.markup.Action.value = null
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojo.publish("transferFilterNumber");
+
+ t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
+
+ dojox.wire.ml.tests.markup.Action.value = 20;
+ dojo.publish("transferFilterNumber");
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ },
+
+ function test_ActionFilter_requiredSpecificBoolean(t){
+ dojox.wire.ml.tests.markup.Action.value = null;
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojo.publish("transferFilterBoolean");
+
+ t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
+
+ dojox.wire.ml.tests.markup.Action.value = true;
+ dojo.publish("transferFilterBoolean");
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ },
+
+ function test_ActionFilter_requiredSpecificString(t){
+ dojox.wire.ml.tests.markup.Action.target = {};
+ dojox.wire.ml.tests.markup.Action.value = null;
+ dojo.publish("transferFilterString");
+
+ t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
+
+ dojox.wire.ml.tests.markup.Action.value = "executeThis";
+ dojo.publish("transferFilterString");
+ t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
+ }
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.Action"
+ trigger="dojox.wire.ml.tests.markup.Action"
+ triggerEvent="transfer">
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.b"
+ target="dojox.wire.ml.tests.markup.Action.target.b"></div>
+</div>
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transfer">
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+</div>
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferFilter">
+ <div dojoType="dojox.wire.ml.ActionFilter"
+ required="dojox.wire.ml.tests.markup.Action.required"
+ message="no required"
+ error="dojox.wire.ml.tests.markup.Action.error"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+</div>
+
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferFilterNumber">
+ <div dojoType="dojox.wire.ml.ActionFilter"
+ required="dojox.wire.ml.tests.markup.Action.value"
+ requiredValue="20"
+ type="number">
+ </div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+</div>
+
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferFilterBoolean">
+ <div dojoType="dojox.wire.ml.ActionFilter"
+ required="dojox.wire.ml.tests.markup.Action.value"
+ requiredValue="true"
+ type="boolean">
+ </div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+</div>
+
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferFilterString">
+ <div dojoType="dojox.wire.ml.ActionFilter"
+ required="dojox.wire.ml.tests.markup.Action.value"
+ requiredValue="executeThis">
+ </div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Action.source.a"
+ target="dojox.wire.ml.tests.markup.Action.target.a"></div>
+</div>
+
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/markup/Data.html b/includes/js/dojox/wire/tests/markup/Data.html
new file mode 100644
index 0000000..b1107c0
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Data.html
@@ -0,0 +1,105 @@
+<html>
+<head>
+<title>Test Data</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.Data");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.wire.ml.Action");
+dojo.require("dojox.wire.ml.Data");
+dojo.require("dojox.wire.ml.Transfer");
+
+dojox.wire.ml.tests.markup.Data = {};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.Data", [
+
+ function test_DataProperty(t){
+ dojox.wire.ml.tests.markup.Data.target = {};
+ dojo.publish("transfer");
+ t.assertEqual("A", dojox.wire.ml.tests.markup.Data.target.a);
+ t.assertEqual(1, dojox.wire.ml.tests.markup.Data.target.b);
+ t.assertEqual(true, dojox.wire.ml.tests.markup.Data.target.c);
+ t.assertEqual("DA", dojox.wire.ml.tests.markup.Data.target.d.a);
+ t.assertEqual("DB", dojox.wire.ml.tests.markup.Data.target.d.b);
+ t.assertEqual("E1", dojox.wire.ml.tests.markup.Data.target.e[0]);
+ t.assertEqual("E2", dojox.wire.ml.tests.markup.Data.target.e[1]);
+ t.assertEqual("F", dojox.wire.ml.tests.markup.Data.target.f);
+ t.assertEqual("G", dojox.wire.ml.tests.markup.Data.target.g);
+ }
+
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.Data"
+ id="Data1">
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="a"
+ value="A"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="b"
+ type="number" value="1"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="c"
+ type="boolean" value="true"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="d"
+ type="object">
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="a"
+ value="DA"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="b"
+ value="DB"></div>
+ </div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="e"
+ type="array">
+ <div dojoType="dojox.wire.ml.DataProperty"
+ value="E1"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ value="E2"></div>
+ </div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="f"
+ type="element"
+ value="x">
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="text()"
+ value="F"></div>
+ <div dojoType="dojox.wire.ml.DataProperty"
+ name="@y"
+ value="G"></div>
+ </div>
+</div>
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transfer">
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.a"
+ target="dojox.wire.ml.tests.markup.Data.target.a"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.b"
+ target="dojox.wire.ml.tests.markup.Data.target.b"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.c"
+ target="dojox.wire.ml.tests.markup.Data.target.c"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.d"
+ target="dojox.wire.ml.tests.markup.Data.target.d"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.e"
+ target="dojox.wire.ml.tests.markup.Data.target.e"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.f"
+ target="dojox.wire.ml.tests.markup.Data.target.f"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="Data1.f.@y"
+ target="dojox.wire.ml.tests.markup.Data.target.g"></div>
+</div>
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/markup/DataStore.html b/includes/js/dojox/wire/tests/markup/DataStore.html
new file mode 100644
index 0000000..3c55f7e
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/DataStore.html
@@ -0,0 +1,66 @@
+<html>
+<head>
+<title>Test DataStore</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.DataStore");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.wire.ml.DataStore");
+dojo.require("dojox.wire.ml.Invocation");
+dojo.require("dojox.wire.ml.Transfer");
+
+dojox.wire.ml.tests.markup.DataStore = {
+ request: {onComplete: function(){}, onError: function(){}}
+};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.DataStore", [
+
+ function test_DataStore_url(t){
+ var d = new doh.Deferred();
+ dojo.connect(dojox.wire.ml.tests.markup.DataStore.request, "onComplete", function(){
+ t.assertEqual("X1", dojox.wire.ml.tests.markup.DataStore.target[0].a);
+ t.assertEqual("Y2", dojox.wire.ml.tests.markup.DataStore.target[1].b);
+ t.assertEqual("Z3", dojox.wire.ml.tests.markup.DataStore.target[2].c);
+ d.callback(true);
+ });
+ dojo.connect(dojox.wire.ml.tests.markup.DataStore.request, "onError", function(error){
+ d.errback(error);
+ });
+ dojo.publish("invokeFetch");
+ return d;
+ }
+
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.DataStore"
+ id="DataStore1"
+ storeClass="dojox.data.XmlStore"
+ url="DataStore.xml"></div>
+<div dojoType="dojox.wire.ml.Invocation"
+ triggerTopic="invokeFetch"
+ object="DataStore1"
+ method="fetch"
+ parameters="dojox.wire.ml.tests.markup.DataStore.request">
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ trigger="dojox.wire.ml.tests.markup.DataStore.request"
+ triggerEvent="onComplete"
+ source="arguments[0]"
+ sourceStore="DataStore1.store"
+ target="dojox.wire.ml.tests.markup.DataStore.target">
+ <div dojoType="dojox.wire.ml.ColumnWire"
+ column="a" attribute="x"></div>
+ <div dojoType="dojox.wire.ml.ColumnWire"
+ column="b" attribute="y"></div>
+ <div dojoType="dojox.wire.ml.ColumnWire"
+ column="c" attribute="z"></div>
+</div>
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/markup/DataStore.xml b/includes/js/dojox/wire/tests/markup/DataStore.xml
new file mode 100644
index 0000000..eeff4c2
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/DataStore.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<dataStore>
+ <item>
+ <x>X1</x>
+ <y>Y1</y>
+ <z>Z1</z>
+ </item>
+ <item>
+ <x>X2</x>
+ <y>Y2</y>
+ <z>Z2</z>
+ </item>
+ <item>
+ <x>X3</x>
+ <y>Y3</y>
+ <z>Z3</z>
+ </item>
+</dataStore>
diff --git a/includes/js/dojox/wire/tests/markup/Invocation.html b/includes/js/dojox/wire/tests/markup/Invocation.html
new file mode 100644
index 0000000..dd6f6e4
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Invocation.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<title>Test Invocation</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad:true "></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.Invocation");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.wire.ml.Invocation");
+
+dojox.wire.ml.tests.markup.Invocation = {
+ invoke: function(p1, p2){return p1 + p2;},
+ invokeError: function(p){throw new Error(p);},
+ parameters: {a: "A", b: "B", c: "C"}
+};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.Invocation", [
+
+ function test_Invocation_method(t){
+ dojo.publish("invokeMethod");
+ t.assertEqual("AB", dojox.wire.ml.tests.markup.Invocation.result);
+ },
+
+ function test_Invocation_topic(t){
+ dojo.publish("invokeTopic");
+ t.assertEqual("C", dojox.wire.ml.tests.markup.Invocation.error);
+ }
+
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.Invocation"
+ triggerTopic="invokeMethod"
+ object="dojox.wire.ml.tests.markup.Invocation"
+ method="invoke"
+ parameters="dojox.wire.ml.tests.markup.Invocation.parameters.a,dojox.wire.ml.tests.markup.Invocation.parameters.b"
+ result="dojox.wire.ml.tests.markup.Invocation.result"></div>
+<div dojoType="dojox.wire.ml.Invocation"
+ triggerTopic="invokeTopic"
+ topic="invokeError"
+ parameters="dojox.wire.ml.tests.markup.Invocation.parameters.c"></div>
+<div dojoType="dojox.wire.ml.Invocation"
+ triggerTopic="invokeError"
+ object="dojox.wire.ml.tests.markup.Invocation"
+ method="invokeError"
+ error="dojox.wire.ml.tests.markup.Invocation.error"></div>
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/markup/Service.html b/includes/js/dojox/wire/tests/markup/Service.html
new file mode 100644
index 0000000..0448c61
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Service.html
@@ -0,0 +1,84 @@
+<html>
+<head>
+<title>Test Service</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.Service");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.wire.ml.Service");
+dojo.require("dojox.wire.ml.Invocation");
+dojo.require("dojox.wire.ml.Transfer");
+
+dojox.wire.ml.tests.markup.Service = {
+ query: {name: "a"}
+};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.Service", [
+
+ function test_Service_url(t){
+ var d = new doh.Deferred();
+ dojo.connect(dijit.byId("Invocation1"), "onComplete", function(result){
+ t.assertEqual("a", dojox.wire.ml.tests.markup.Service.target.a);
+ var o = result.toObject();
+ t.assertEqual("a", o.item.name); // test XmlElement.toObject()
+ t.assertEqual("b", o.item.data); // test XmlElement.toObject()
+
+ d.callback(true);
+ });
+ dojo.connect(dijit.byId("Invocation1"), "onError", function(error){
+ d.errback(error);
+ });
+ dojo.publish("invokeGetXml");
+ return d;
+ },
+
+ function test_Service_serviceUrl(t){
+ var d = new doh.Deferred();
+ dojo.connect(dijit.byId("Invocation2"), "onComplete", function(){
+ t.assertEqual("a", dojox.wire.ml.tests.markup.Service.result.item.name);
+ d.callback(true);
+ });
+ dojo.connect(dijit.byId("Invocation2"), "onError", function(error){
+ d.errback(error);
+ });
+ dojo.publish("invokeGetJson");
+ return d;
+ }
+
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.Service"
+ id="Service1"
+ url="Service/XML.smd"></div>
+<div dojoType="dojox.wire.ml.Invocation"
+ id="Invocation1"
+ triggerTopic="invokeGetXml"
+ object="Service1"
+ method="get"
+ parameters="dojox.wire.ml.tests.markup.Service.query">
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ trigger="Invocation1"
+ triggerEvent="onComplete"
+ source="arguments[0].item.name"
+ target="dojox.wire.ml.tests.markup.Service.target.a"></div>
+<div dojoType="dojox.wire.ml.Service"
+ id="Service2"
+ serviceType="JSON"
+ serviceUrl="Service/{name}.json"></div>
+<div dojoType="dojox.wire.ml.Invocation"
+ id="Invocation2"
+ triggerTopic="invokeGetJson"
+ object="Service2"
+ method="get"
+ parameters="dojox.wire.ml.tests.markup.Service.query"
+ result="dojox.wire.ml.tests.markup.Service.result"></div>
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/markup/Service/JSON.smd b/includes/js/dojox/wire/tests/markup/Service/JSON.smd
new file mode 100644
index 0000000..2ac9682
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Service/JSON.smd
@@ -0,0 +1,11 @@
+{
+ "serviceType": "JSON",
+ "serviceURL": "Service/{name}.json",
+ "methods": [{
+ "name": "get",
+ "parameters": [{
+ "name": "name",
+ "type": "str"
+ }]
+ }]
+}
diff --git a/includes/js/dojox/wire/tests/markup/Service/XML.smd b/includes/js/dojox/wire/tests/markup/Service/XML.smd
new file mode 100644
index 0000000..d833f88
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Service/XML.smd
@@ -0,0 +1,11 @@
+{
+ "serviceType": "XML",
+ "serviceURL": "Service/{name}.xml",
+ "methods": [{
+ "name": "get",
+ "parameters": [{
+ "name": "name",
+ "type": "str"
+ }]
+ }]
+}
diff --git a/includes/js/dojox/wire/tests/markup/Service/a.json b/includes/js/dojox/wire/tests/markup/Service/a.json
new file mode 100644
index 0000000..93fc00b
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Service/a.json
@@ -0,0 +1,5 @@
+{
+ "item": {
+ "name": "a"
+ }
+}
diff --git a/includes/js/dojox/wire/tests/markup/Service/a.xml b/includes/js/dojox/wire/tests/markup/Service/a.xml
new file mode 100644
index 0000000..21e4367
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Service/a.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<item>
+ <name>a</name>
+ <data><![CDATA[b]]></data>
+</item>
diff --git a/includes/js/dojox/wire/tests/markup/Transfer.html b/includes/js/dojox/wire/tests/markup/Transfer.html
new file mode 100644
index 0000000..3ec11a4
--- /dev/null
+++ b/includes/js/dojox/wire/tests/markup/Transfer.html
@@ -0,0 +1,157 @@
+<html>
+<head>
+<title>Test Transfer</title>
+<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+<script type="text/javascript">
+dojo.provide("dojox.wire.ml.tests.markup.Transfer");
+
+dojo.require("dojo.parser");
+dojo.require("doh.runner");
+dojo.require("dojox.data.dom");
+dojo.require("dojox.data.XmlStore");
+dojo.require("dojox.wire.ml.Action");
+dojo.require("dojox.wire.ml.Transfer");
+
+dojox.wire.ml.tests.markup.Transfer = {
+ source: {a: "A", b: "B", c: [
+ {d: "D1", e: "E1"},
+ {d: "D2", e: "E2"}
+ ]}
+};
+
+dojo.addOnLoad(function(){
+ doh.register("dojox.wire.ml.tests.markup.Transfer", [
+
+ function test_Transfer_attribute(t){
+ dojox.wire.ml.tests.markup.Transfer.store = new dojox.data.XmlStore();
+ dojox.wire.ml.tests.markup.Transfer.item = dojox.wire.ml.tests.markup.Transfer.store.newItem({tagName: "x"});
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferData");
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.a);
+ },
+
+ function test_Transfer_path(t){
+ dojox.wire.ml.tests.markup.Transfer.element = dojox.data.dom.createDocument().createElement("x");
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferXml");
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.a);
+ },
+
+ function test_ChildWire(t){
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferComposite");
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.a, dojox.wire.ml.tests.markup.Transfer.target.c);
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.b, dojox.wire.ml.tests.markup.Transfer.target.d);
+ },
+
+ function test_ColumnWire(t){
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferTable");
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[0].d, dojox.wire.ml.tests.markup.Transfer.target.a[0].b);
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[1].e, dojox.wire.ml.tests.markup.Transfer.target.a[1].c);
+ },
+
+ function test_NodeWire(t){
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferTree");
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[0].d, dojox.wire.ml.tests.markup.Transfer.target.a[0].title);
+ t.assertEqual(dojox.wire.ml.tests.markup.Transfer.source.c[1].e, dojox.wire.ml.tests.markup.Transfer.target.a[1].children[0].title);
+ },
+
+ function test_SegimentWire(t){
+ dojox.wire.ml.tests.markup.Transfer.target = {};
+ dojo.publish("transferText");
+ t.assertEqual("A/B", dojox.wire.ml.tests.markup.Transfer.target.c);
+ }
+
+ ]);
+ doh.run();
+});
+</script>
+</head>
+<body>
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferData">
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.source.a"
+ target="dojox.wire.ml.tests.markup.Transfer.item"
+ targetStore="dojox.wire.ml.tests.markup.Transfer.store"
+ targetAttribute="y"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.item"
+ sourceStore="dojox.wire.ml.tests.markup.Transfer.store"
+ sourceAttribute="y"
+ target="dojox.wire.ml.tests.markup.Transfer.target.a"></div>
+</div>
+<div dojoType="dojox.wire.ml.Action"
+ triggerTopic="transferXml">
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.source.a"
+ target="dojox.wire.ml.tests.markup.Transfer.element"
+ targetPath="y/text()"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.element"
+ sourcePath="y/text()"
+ target="dojox.wire.ml.tests.markup.Transfer.target.a"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.source.b"
+ target="dojox.wire.ml.tests.markup.Transfer.element"
+ targetPath="y/@z"></div>
+ <div dojoType="dojox.wire.ml.Transfer"
+ source="dojox.wire.ml.tests.markup.Transfer.element"
+ sourcePath="y/@z"
+ target="dojox.wire.ml.tests.markup.Transfer.target.b"></div>
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ triggerTopic="transferComposite"
+ source="dojox.wire.ml.tests.markup.Transfer.source"
+ target="dojox.wire.ml.tests.markup.Transfer.target">
+ <div dojoType="dojox.wire.ml.ChildWire"
+ name="x"
+ property="a"></div>
+ <div dojoType="dojox.wire.ml.ChildWire"
+ which="source"
+ name="y"
+ property="b"></div>
+ <div dojoType="dojox.wire.ml.ChildWire"
+ which="target"
+ name="x"
+ property="c"></div>
+ <div dojoType="dojox.wire.ml.ChildWire"
+ which="target"
+ name="y"
+ property="d"></div>
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ triggerTopic="transferTable"
+ source="dojox.wire.ml.tests.markup.Transfer.source.c"
+ target="dojox.wire.ml.tests.markup.Transfer.target.a">
+ <div dojoType="dojox.wire.ml.ColumnWire"
+ column="b"
+ property="d"></div>
+ <div dojoType="dojox.wire.ml.ColumnWire"
+ column="c"
+ property="e"></div>
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ triggerTopic="transferTree"
+ source="dojox.wire.ml.tests.markup.Transfer.source.c"
+ target="dojox.wire.ml.tests.markup.Transfer.target.a">
+ <div dojoType="dojox.wire.ml.NodeWire"
+ titleProperty="d">
+ <div dojoType="dojox.wire.ml.NodeWire"
+ titleProperty="e"></div>
+ </div>
+</div>
+<div dojoType="dojox.wire.ml.Transfer"
+ triggerTopic="transferText"
+ source="dojox.wire.ml.tests.markup.Transfer.source"
+ delimiter="/"
+ target="dojox.wire.ml.tests.markup.Transfer.target.c">
+ <div dojoType="dojox.wire.ml.SegmentWire"
+ property="a"></div>
+ <div dojoType="dojox.wire.ml.SegmentWire"
+ property="b"></div>
+</div>
+</body>
+</html>
diff --git a/includes/js/dojox/wire/tests/module.js b/includes/js/dojox/wire/tests/module.js
new file mode 100644
index 0000000..17f10c3
--- /dev/null
+++ b/includes/js/dojox/wire/tests/module.js
@@ -0,0 +1,13 @@
+if(!dojo._hasResource["dojox.wire.tests.module"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.module"] = true;
+dojo.provide("dojox.wire.tests.module");
+
+try{
+ dojo.require("dojox.wire.tests.wire");
+ dojo.require("dojox.wire.tests.wireml");
+}catch(e){
+ doh.debug(e);
+}
+
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/CompositeWire.js b/includes/js/dojox/wire/tests/programmatic/CompositeWire.js
new file mode 100644
index 0000000..ae9866a
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/CompositeWire.js
@@ -0,0 +1,51 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.CompositeWire"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.CompositeWire"] = true;
+dojo.provide("dojox.wire.tests.programmatic.CompositeWire");
+
+dojo.require("dojox.wire.CompositeWire");
+
+tests.register("dojox.wire.tests.programmatic.CompositeWire", [
+
+ function test_CompositeWire_children(t){
+ var source = {a: "A", b: "B"};
+ var target = {};
+ var children = {x: {property: "a"}, y: {property: "b"}};
+ var value = new dojox.wire.CompositeWire({object: source, children: children}).getValue();
+ t.assertEqual(source.a, value.x);
+ t.assertEqual(source.b, value.y);
+ new dojox.wire.CompositeWire({object: target, children: children}).setValue(value);
+ t.assertEqual(source.a, target.a);
+ t.assertEqual(source.b, target.b);
+
+ // with argument
+ target = {};
+ value = new dojox.wire.CompositeWire({children: children}).getValue(source);
+ t.assertEqual(source.a, value.x);
+ t.assertEqual(source.b, value.y);
+ new dojox.wire.CompositeWire({children: children}).setValue(value, target);
+ t.assertEqual(source.a, target.a);
+ t.assertEqual(source.b, target.b);
+
+ // by array
+ target = {};
+ children = [{property: "a"}, {property: "b"}];
+ value = new dojox.wire.CompositeWire({object: source, children: children}).getValue();
+ t.assertEqual(source.a, value[0]);
+ t.assertEqual(source.b, value[1]);
+ new dojox.wire.CompositeWire({object: target, children: children}).setValue(value);
+ t.assertEqual(source.a, target.a);
+ t.assertEqual(source.b, target.b);
+
+ // by array with argument
+ target = {};
+ value = new dojox.wire.CompositeWire({children: children}).getValue(source);
+ t.assertEqual(source.a, value[0]);
+ t.assertEqual(source.b, value[1]);
+ new dojox.wire.CompositeWire({children: children}).setValue(value, target);
+ t.assertEqual(source.a, target.a);
+ t.assertEqual(source.b, target.b);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/ConverterDynamic.js b/includes/js/dojox/wire/tests/programmatic/ConverterDynamic.js
new file mode 100644
index 0000000..2665148
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/ConverterDynamic.js
@@ -0,0 +1,12 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.ConverterDynamic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.ConverterDynamic"] = true;
+dojo.provide("dojox.wire.tests.programmatic.ConverterDynamic");
+
+dojo.declare("dojox.wire.tests.programmatic.ConverterDynamic", null, {
+ convert: function(v){
+ return v + 1;
+ }
+});
+
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/DataWire.js b/includes/js/dojox/wire/tests/programmatic/DataWire.js
new file mode 100644
index 0000000..b146901
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/DataWire.js
@@ -0,0 +1,25 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.DataWire"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.DataWire"] = true;
+dojo.provide("dojox.wire.tests.programmatic.DataWire");
+
+dojo.require("dojox.wire.DataWire");
+dojo.require("dojox.data.XmlStore");
+
+tests.register("dojox.wire.tests.programmatic.DataWire", [
+
+ function test_DataWire_attribute(t){
+ var store = new dojox.data.XmlStore();
+ var item = store.newItem({tagName: "x"});
+ new dojox.wire.DataWire({dataStore: store, object: item, attribute: "y"}).setValue("Y");
+ var value = new dojox.wire.DataWire({dataStore: store, object: item, attribute: "y"}).getValue();
+ t.assertEqual("Y", value);
+
+ // nested attribute
+ new dojox.wire.DataWire({dataStore: store, object: item, attribute: "y.z"}).setValue("Z");
+ value = new dojox.wire.DataWire({dataStore: store, object: item, attribute: "y.z"}).getValue();
+ t.assertEqual("Z", value);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/TableAdapter.js b/includes/js/dojox/wire/tests/programmatic/TableAdapter.js
new file mode 100644
index 0000000..9e6adc1
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/TableAdapter.js
@@ -0,0 +1,24 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.TableAdapter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.TableAdapter"] = true;
+dojo.provide("dojox.wire.tests.programmatic.TableAdapter");
+
+dojo.require("dojox.wire.TableAdapter");
+
+tests.register("dojox.wire.tests.programmatic.TableAdapter", [
+
+ function test_TableAdapter_columns(t){
+ var source = [
+ {a: "A1", b: "B1", c: "C1"},
+ {a: "A2", b: "B2", c: "C2"},
+ {a: "A3", b: "B3", c: "C3"}
+ ];
+ var columns = {x: {property: "a"}, y: {property: "b"}, z: {property: "c"}};
+ var value = new dojox.wire.TableAdapter({object: source, columns: columns}).getValue();
+ t.assertEqual(source[0].a, value[0].x);
+ t.assertEqual(source[1].b, value[1].y);
+ t.assertEqual(source[2].c, value[2].z);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/TextAdapter.js b/includes/js/dojox/wire/tests/programmatic/TextAdapter.js
new file mode 100644
index 0000000..1014b5c
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/TextAdapter.js
@@ -0,0 +1,25 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.TextAdapter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.TextAdapter"] = true;
+dojo.provide("dojox.wire.tests.programmatic.TextAdapter");
+
+dojo.require("dojox.wire.TextAdapter");
+
+tests.register("dojox.wire.tests.programmatic.TextAdapter", [
+
+ function test_TextAdapter_segments(t){
+ var source = {a: "a", b: "b", c: "c"};
+ var segments = [{property: "a"}, {property: "b"}, {property: "c"}];
+ var value = new dojox.wire.TextAdapter({object: source, segments: segments}).getValue();
+ t.assertEqual("abc", value);
+ },
+
+ function test_TextAdapter_delimiter(t){
+ var source = {a: "a", b: "b", c: "c"};
+ var segments = [{property: "a"}, {property: "b"}, {property: "c"}];
+ var value = new dojox.wire.TextAdapter({object: source, segments: segments, delimiter: "/"}).getValue();
+ t.assertEqual("a/b/c", value);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/TreeAdapter.js b/includes/js/dojox/wire/tests/programmatic/TreeAdapter.js
new file mode 100644
index 0000000..e1671ed
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/TreeAdapter.js
@@ -0,0 +1,29 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"] = true;
+dojo.provide("dojox.wire.tests.programmatic.TreeAdapter");
+
+dojo.require("dojox.wire.TreeAdapter");
+
+tests.register("dojox.wire.tests.programmatic.TreeAdapter", [
+
+ function test_TreeAdapter_nodes(t){
+ var source = [
+ {a: "A1", b: "B1", c: "C1"},
+ {a: "A2", b: "B2", c: "C2"},
+ {a: "A3", b: "B3", c: "C3"}
+ ];
+ var nodes = [
+ {title: {property: "a"}, children: [
+ {node: {property: "b"}},
+ {title: {property: "c"}}
+ ]}
+ ];
+ var value = new dojox.wire.TreeAdapter({object: source, nodes: nodes}).getValue();
+ t.assertEqual(source[0].a, value[0].title);
+ t.assertEqual(source[1].b, value[1].children[0].title);
+ t.assertEqual(source[2].c, value[2].children[1].title);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/Wire.js b/includes/js/dojox/wire/tests/programmatic/Wire.js
new file mode 100644
index 0000000..25a82ec
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/Wire.js
@@ -0,0 +1,123 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.Wire"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.Wire"] = true;
+dojo.provide("dojox.wire.tests.programmatic.Wire");
+dojo.require("dojox.wire.Wire");
+
+//Simple connverter class to try to use.
+dojo.declare("dojox.wire.tests.programmatic.Wire.Converter", null, {
+ convert: function(v){
+ return v + 1;
+ }
+});
+
+//Simple converter function to try to use.
+//To get it in the global namespace, gotta assign it to the
+//'window' toplevel object. Otherwise it ends up in the
+//dojo NS and can't be found.
+if (dojo.isBrowser) {
+ window["__wireTestConverterFunction"] = function(v){
+ return v + 1;
+ };
+}else{
+ var __wireTestConverterFunction = function(v){
+ return v + 1;
+ };
+}
+
+tests.register("dojox.wire.tests.programmatic.Wire", [
+
+ function test_Wire_property(t){
+ var source = {a: "A", b: {c: "B.C"}};
+ var target = {a: "a", b: {c: "b.c"}};
+ var value = new dojox.wire.Wire({object: source, property: "a"}).getValue();
+ new dojox.wire.Wire({object: target, property: "a"}).setValue(value);
+ t.assertEqual(source.a, target.a);
+
+ // child property
+ value = new dojox.wire.Wire({object: source, property: "b.c"}).getValue();
+ new dojox.wire.Wire({object: target, property: "b.c"}).setValue(value);
+ t.assertEqual(source.b.c, target.b.c);
+
+ // new property
+ target = {};
+ value = new dojox.wire.Wire({object: source, property: "a"}).getValue();
+ new dojox.wire.Wire({object: target, property: "a"}).setValue(value);
+ t.assertEqual(source.a, target.a);
+
+ // new parent and child property
+ target.b = {};
+ value = new dojox.wire.Wire({object: source, property: "b.c"}).getValue();
+ new dojox.wire.Wire({object: target, property: "b.c"}).setValue(value);
+ t.assertEqual(source.b.c, target.b.c);
+
+ // new parent and child property
+ target = {};
+ value = new dojox.wire.Wire({object: source, property: "b.c"}).getValue();
+ new dojox.wire.Wire({object: target, property: "b.c"}).setValue(value);
+ t.assertEqual(source.b.c, target.b.c);
+
+ // new array property
+ source = {a: ["A"]};
+ target = {};
+ value = new dojox.wire.Wire({object: source, property: "a[0]"}).getValue();
+ new dojox.wire.Wire({object: target, property: "a[0]"}).setValue(value);
+ t.assertEqual(source.a[0], target.a[0]);
+
+ // by getter/setter
+ source = {getA: function() { return this._a; }, _a: "A"};
+ target = {setA: function(a) { this._a = a; }};
+ value = new dojox.wire.Wire({object: source, property: "a"}).getValue();
+ new dojox.wire.Wire({object: target, property: "a"}).setValue(value);
+ t.assertEqual(source._a, target._a);
+
+ // by get/setPropertyValue
+ source = {getPropertyValue: function(p) { return this["_" + p]; }, _a: "A"};
+ target = {setPropertyValue: function(p, v) { this["_" + p] = v; }};
+ value = new dojox.wire.Wire({object: source, property: "a"}).getValue();
+ new dojox.wire.Wire({object: target, property: "a"}).setValue(value);
+ t.assertEqual(source._a, target._a);
+ },
+
+ function test_Wire_type(t){
+ var source = {a: "1"};
+ var string = new dojox.wire.Wire({object: source, property: "a"}).getValue();
+ t.assertEqual("11", string + 1);
+ var number = new dojox.wire.Wire({object: source, property: "a", type: "number"}).getValue();
+ t.assertEqual(2, number + 1);
+ },
+
+ function test_Wire_converterObject(t){
+ var source = {a: "1"};
+ var converter = {convert: function(v) { return v + 1; }};
+ var string = new dojox.wire.Wire({object: source, property: "a", converter: converter}).getValue();
+ t.assertEqual("11", string);
+ },
+
+ function test_Wire_converterFunction(t){
+ var source = {a: "1"};
+ var converter = {convert: function(v) { return v + 1; }};
+ var number = new dojox.wire.Wire({object: source, property: "a", type: "number", converter: converter.convert}).getValue();
+ t.assertEqual(2, number);
+ },
+
+ function test_Wire_converterObjectByString(t){
+ var source = {a: "1"};
+ var number = new dojox.wire.Wire({object: source, property: "a", type: "number", converter: "dojox.wire.tests.programmatic.Wire.Converter"}).getValue();
+ t.assertEqual(2, number);
+ },
+
+ function test_Wire_converterFunctionByString(t){
+ var source = {a: "1"};
+ var number = new dojox.wire.Wire({object: source, property: "a", type: "number", converter: "__wireTestConverterFunction"}).getValue();
+ t.assertEqual(2, number);
+ },
+
+ function test_Wire_converterObjectByStringDynamic(t){
+ var source = {a: "1"};
+ var number = new dojox.wire.Wire({object: source, property: "a", type: "number", converter: "dojox.wire.tests.programmatic.ConverterDynamic"}).getValue();
+ t.assertEqual(2, number);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/XmlWire.js b/includes/js/dojox/wire/tests/programmatic/XmlWire.js
new file mode 100644
index 0000000..b0772d7
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/XmlWire.js
@@ -0,0 +1,32 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic.XmlWire"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic.XmlWire"] = true;
+dojo.provide("dojox.wire.tests.programmatic.XmlWire");
+
+dojo.require("dojox.wire.XmlWire");
+
+tests.register("dojox.wire.tests.programmatic.XmlWire", [
+
+ function test_XmlWire_path(t){
+ var object = {};
+ var wire = dojox.wire.create({object: object, property: "element"});
+ new dojox.wire.XmlWire({object: wire, path: "/x/y/text()"}).setValue("Y");
+ var value = new dojox.wire.XmlWire({object: object, property: "element", path: "y/text()"}).getValue();
+ t.assertEqual("Y", value);
+
+ // attribute
+ new dojox.wire.XmlWire({object: object, property: "element", path: "y/@z"}).setValue("Z");
+ value = new dojox.wire.XmlWire({object: wire, path: "/x/y/@z"}).getValue();
+ t.assertEqual("Z", value);
+
+ // with index
+ var document = object.element.ownerDocument;
+ var element = document.createElement("y");
+ element.appendChild(document.createTextNode("Y2"));
+ object.element.appendChild(element);
+ value = new dojox.wire.XmlWire({object: object.element, path: "y[2]/text()"}).getValue();
+ t.assertEqual("Y2", value);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/programmatic/_base.js b/includes/js/dojox/wire/tests/programmatic/_base.js
new file mode 100644
index 0000000..00f9abe
--- /dev/null
+++ b/includes/js/dojox/wire/tests/programmatic/_base.js
@@ -0,0 +1,111 @@
+if(!dojo._hasResource["dojox.wire.tests.programmatic._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.programmatic._base"] = true;
+dojo.provide("dojox.wire.tests.programmatic._base");
+
+dojo.require("dojox.wire._base");
+
+tests.register("dojox.wire.tests.programmatic._base", [
+
+ function test_create(t){
+ var wire = dojox.wire.create({});
+ t.assertTrue(wire instanceof dojox.wire.Wire);
+
+ wire = dojox.wire.create({property: "a"});
+ t.assertTrue(wire instanceof dojox.wire.Wire);
+
+ wire = dojox.wire.create({attribute: "a"});
+ t.assertTrue(wire instanceof dojox.wire.DataWire);
+
+ wire = dojox.wire.create({path: "a"});
+ t.assertTrue(wire instanceof dojox.wire.XmlWire);
+
+ wire = dojox.wire.create({children: "a"});
+ t.assertTrue(wire instanceof dojox.wire.CompositeWire);
+
+ wire = dojox.wire.create({columns: "a"});
+ t.assertTrue(wire instanceof dojox.wire.TableAdapter);
+
+ wire = dojox.wire.create({nodes: "a"});
+ t.assertTrue(wire instanceof dojox.wire.TreeAdapter);
+
+ wire = dojox.wire.create({segments: "a"});
+ t.assertTrue(wire instanceof dojox.wire.TextAdapter);
+
+ wire = dojox.wire.create({wireClass: "dojox.wire.DataWire"});
+ t.assertTrue(wire instanceof dojox.wire.DataWire);
+ },
+
+ function test_transfer(t){
+ var source = {a: "A"};
+ var target = {};
+ dojox.wire.transfer(
+ {object: source, property: "a"},
+ {object: target, property: "a"});
+ t.assertEqual(source.a, target.a);
+ },
+
+ function test_connect(t){
+ var trigger = {transfer: function() {}, transferArgument: function() {}};
+ var source = {a: "A"};
+ var target = {};
+ dojox.wire.connect({scope: trigger, event: "transfer"},
+ {object: source, property: "a"},
+ {object: target, property: "a"});
+ trigger.transfer();
+ t.assertEqual(source.a, target.a);
+
+ // with argument
+ target = {};
+ dojox.wire.connect({scope: trigger, event: "transferArgument"},
+ {property: "[0].a"},
+ {object: target, property: "a"});
+ trigger.transferArgument(source);
+ t.assertEqual(source.a, target.a);
+
+ // by topic
+ target = {};
+ dojox.wire.connect({topic: "transfer"},
+ {object: source, property: "a"},
+ {object: target, property: "a"});
+ dojo.publish("transfer");
+ t.assertEqual(source.a, target.a);
+
+ // by topic with argument
+ target = {};
+ dojox.wire.connect({topic: "transferArgument"},
+ {property: "[0].a"},
+ {object: target, property: "a"});
+ dojo.publish("transferArgument", [source]);
+ t.assertEqual(source.a, target.a);
+ },
+
+ function test_disconnect(t){
+ var trigger = {transferDisconnect: function() {}};
+ var source = {a: "A"};
+ var target = {};
+ var connection = dojox.wire.connect({scope: trigger, event: "transferDisconnect"},
+ {object: source, property: "a"},
+ {object: target, property: "a"});
+ trigger.transferDisconnect();
+ t.assertEqual(source.a, target.a);
+ delete target.a;
+ dojox.wire.disconnect(connection);
+ trigger.transferDisconnect();
+ t.assertEqual(undefined, target.a);
+
+ // by topic
+ target = {};
+ connection = dojox.wire.connect({topic: "transferDisconnect"},
+ {object: source, property: "a"},
+ {object: target, property: "a"});
+ dojo.publish("transferDisconnect");
+ t.assertEqual(source.a, target.a);
+ delete target.a;
+ dojox.wire.disconnect(connection);
+ dojo.publish("transferDisconnect");
+ t.assertEqual(undefined, target.a);
+ }
+
+]);
+
+}
diff --git a/includes/js/dojox/wire/tests/runTests.html b/includes/js/dojox/wire/tests/runTests.html
new file mode 100644
index 0000000..f4a51de
--- /dev/null
+++ b/includes/js/dojox/wire/tests/runTests.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Dojox.wire Unit Test Runner</title>
+ <meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.wire.tests.module"></HEAD>
+ <BODY>
+ Redirecting to D.O.H runner.
+ </BODY>
+</HTML>
diff --git a/includes/js/dojox/wire/tests/wire.js b/includes/js/dojox/wire/tests/wire.js
new file mode 100644
index 0000000..e4e2a21
--- /dev/null
+++ b/includes/js/dojox/wire/tests/wire.js
@@ -0,0 +1,18 @@
+if(!dojo._hasResource["dojox.wire.tests.wire"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.wire"] = true;
+dojo.provide("dojox.wire.tests.wire");
+
+try{
+ dojo.require("dojox.wire.tests.programmatic._base");
+ dojo.require("dojox.wire.tests.programmatic.Wire");
+ dojo.requireIf(dojo.isBrowser, "dojox.wire.tests.programmatic.DataWire");
+ dojo.requireIf(dojo.isBrowser, "dojox.wire.tests.programmatic.XmlWire");
+ dojo.require("dojox.wire.tests.programmatic.CompositeWire");
+ dojo.require("dojox.wire.tests.programmatic.TableAdapter");
+ dojo.require("dojox.wire.tests.programmatic.TreeAdapter");
+ dojo.require("dojox.wire.tests.programmatic.TextAdapter");
+}catch(e){
+ doh.debug(e);
+}
+
+}
diff --git a/includes/js/dojox/wire/tests/wireml.js b/includes/js/dojox/wire/tests/wireml.js
new file mode 100644
index 0000000..db47056
--- /dev/null
+++ b/includes/js/dojox/wire/tests/wireml.js
@@ -0,0 +1,18 @@
+if(!dojo._hasResource["dojox.wire.tests.wireml"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.tests.wireml"] = true;
+dojo.provide("dojox.wire.tests.wireml");
+
+try{
+ if(dojo.isBrowser){
+ doh.registerUrl("dojox.wire.tests.ml.Action", dojo.moduleUrl("dojox", "wire/tests/markup/Action.html"));
+ doh.registerUrl("dojox.wire.tests.ml.Transfer", dojo.moduleUrl("dojox", "wire/tests/markup/Transfer.html"));
+ doh.registerUrl("dojox.wire.tests.ml.Invocation", dojo.moduleUrl("dojox", "wire/tests/markup/Invocation.html"));
+ doh.registerUrl("dojox.wire.tests.ml.Data", dojo.moduleUrl("dojox", "wire/tests/markup/Data.html"));
+ doh.registerUrl("dojox.wire.tests.ml.DataStore", dojo.moduleUrl("dojox", "wire/tests/markup/DataStore.html"));
+ doh.registerUrl("dojox.wire.tests.ml.Service", dojo.moduleUrl("dojox", "wire/tests/markup/Service.html"));
+ }
+}catch(e){
+ doh.debug(e);
+}
+
+}