1 | <html> |
---|
2 | <head> |
---|
3 | <title>Test Invocation</title> |
---|
4 | <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad:true "></script> |
---|
5 | <script type="text/javascript"> |
---|
6 | dojo.provide("dojox.wire.ml.tests.markup.Invocation"); |
---|
7 | |
---|
8 | dojo.require("dojo.parser"); |
---|
9 | dojo.require("doh.runner"); |
---|
10 | dojo.require("dojox.wire.ml.Invocation"); |
---|
11 | |
---|
12 | dojox.wire.ml.tests.markup.Invocation = { |
---|
13 | invoke: function(p1, p2){return p1 + p2;}, |
---|
14 | invokeError: function(p){throw new Error(p);}, |
---|
15 | parameters: {a: "A", b: "B", c: "C"} |
---|
16 | }; |
---|
17 | |
---|
18 | dojo.addOnLoad(function(){ |
---|
19 | doh.register("dojox.wire.ml.tests.markup.Invocation", [ |
---|
20 | |
---|
21 | function test_Invocation_method(t){ |
---|
22 | dojo.publish("invokeMethod"); |
---|
23 | t.assertEqual("AB", dojox.wire.ml.tests.markup.Invocation.result); |
---|
24 | }, |
---|
25 | |
---|
26 | function test_Invocation_topic(t){ |
---|
27 | dojo.publish("invokeTopic"); |
---|
28 | t.assertEqual("C", dojox.wire.ml.tests.markup.Invocation.error); |
---|
29 | } |
---|
30 | |
---|
31 | ]); |
---|
32 | doh.run(); |
---|
33 | }); |
---|
34 | </script> |
---|
35 | </head> |
---|
36 | <body> |
---|
37 | <div dojoType="dojox.wire.ml.Invocation" |
---|
38 | triggerTopic="invokeMethod" |
---|
39 | object="dojox.wire.ml.tests.markup.Invocation" |
---|
40 | method="invoke" |
---|
41 | parameters="dojox.wire.ml.tests.markup.Invocation.parameters.a,dojox.wire.ml.tests.markup.Invocation.parameters.b" |
---|
42 | result="dojox.wire.ml.tests.markup.Invocation.result"></div> |
---|
43 | <div dojoType="dojox.wire.ml.Invocation" |
---|
44 | triggerTopic="invokeTopic" |
---|
45 | topic="invokeError" |
---|
46 | parameters="dojox.wire.ml.tests.markup.Invocation.parameters.c"></div> |
---|
47 | <div dojoType="dojox.wire.ml.Invocation" |
---|
48 | triggerTopic="invokeError" |
---|
49 | object="dojox.wire.ml.tests.markup.Invocation" |
---|
50 | method="invokeError" |
---|
51 | error="dojox.wire.ml.tests.markup.Invocation.error"></div> |
---|
52 | </body> |
---|
53 | </html> |
---|