Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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