aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/wire/tests/markup/DataStore.html
blob: 3c55f7ec02e498e73fd9525d67cb409dc1baedbe (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
<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>