SemanticScuttle/includes/js/dojox/wire/tests/markup/DataStore.html

67 lines
2 KiB
HTML
Raw Normal View History

<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>