diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/wire/tests/markup/Service.html | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/wire/tests/markup/Service.html')
-rw-r--r-- | includes/js/dojox/wire/tests/markup/Service.html | 84 |
1 files changed, 84 insertions, 0 deletions
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> |