summaryrefslogtreecommitdiff
path: root/includes/js/dojox/wire/tests/markup/Transfer.html
blob: 3ec11a4eb7c7c25e10e905aefd7a4a2cfef70d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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>