]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojo/tests/io/iframe.html
Comment class stub
[eow] / static / dojo-release-1.1.1 / dojo / tests / io / iframe.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2         "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4         <head>
5                 <title>Testing dojo.io.iframe</title>
6                 <style type="text/css">
7                         @import "../../resources/dojo.css";
8                 </style>
9                 <script type="text/javascript" 
10                         src="../../dojo.js" djConfig="isDebug: true"></script>
11                 <script type="text/javascript">
12                         dojo.require("doh.runner");
13                         dojo.require("dojo.io.iframe");
14
15                         dojo.addOnLoad(function(){
16                                 doh.register("t", 
17                                         [
18                                                 function ioIframeGetText(t){
19                                                         var d = new doh.Deferred();
20                                                         var td = dojo.io.iframe.send({
21                                                                 url: "iframeResponse.text.html",
22                                                                 method: "GET",
23                                                                 timeoutSeconds: 5,
24                                                                 preventCache: true,
25                                                                 handle: function(res, ioArgs){
26                                                                         if(!(res instanceof Error) && 
27                                                                                 t.is("iframe succeeded", res)){
28                                                                                 d.callback(true);
29                                                                         }else{
30                                                                                 d.errback(false);
31                                                                         }                                                               
32                                                                 }
33                                                         });
34                                                         return d;                                                       
35                                                 },
36
37                                                 function ioIframeGetJson(t){
38                                                         var d = new doh.Deferred();
39                                                         var td = dojo.io.iframe.send({
40                                                                 url: "iframeResponse.json.html",
41                                                                 method: "GET",
42                                                                 timeoutSeconds: 5,
43                                                                 preventCache: true,
44                                                                 handleAs: "json",
45                                                                 handle: function(res, ioArgs){
46                                                                         if(!(res instanceof Error) && 
47                                                                                 t.is("blue", res.color)){
48                                                                                 d.callback(true);
49                                                                         }else{
50                                                                                 d.errback(false);
51                                                                         }                                                               
52                                                                 }
53                                                         });
54                                                         return d;                                                       
55                                                 },
56
57                                                 function ioIframeGetJavascript(t){
58                                                         var d = new doh.Deferred();
59                                                         var td = dojo.io.iframe.send({
60                                                                 url: "iframeResponse.js.html",
61                                                                 method: "GET",
62                                                                 timeoutSeconds: 5,
63                                                                 preventCache: true,
64                                                                 handleAs: "javascript",
65                                                                 handle: function(res, ioArgs){
66                                                                         console.log("RES: ", res);
67                                                                         if(!(res instanceof Error) && 
68                                                                                 t.is(42, window.iframeTestingFunction())){
69                                                                                 d.callback(true);
70                                                                         }else{
71                                                                                 d.errback(false);
72                                                                         }                                                               
73                                                                 }
74                                                         });
75                                                         return d;                                                       
76                                                 },
77
78                                                 function ioIframeGetHtml(t){
79                                                         var d = new doh.Deferred();
80                                                         var td = dojo.io.iframe.send({
81                                                                 url: "iframeResponse.html",
82                                                                 method: "GET",
83                                                                 timeoutSeconds: 5,
84                                                                 preventCache: true,
85                                                                 handleAs: "html",
86                                                                 handle: function(res, ioArgs){
87                                                                         if(!(res instanceof Error) && 
88                                                                                 t.is("SUCCESSFUL HTML response", res.getElementsByTagName("h1")[0].innerHTML)){
89                                                                                 d.callback(true);
90                                                                         }else{
91                                                                                 d.errback(false);
92                                                                         }                                                               
93                                                                 }
94                                                         });
95                                                         return d;                                                       
96                                                 }
97                                         ]
98                                 );
99                                 doh.run();
100                         });
101
102 /*
103 dojo.addOnLoad(function(){
104         var td = dojo.io.iframe.get({
105                 url: "iframeResponse.text.html",
106                 timeoutSeconds: 5,
107                 preventCache: true,
108                 handle: function(res, ioArgs){
109                         if(!(res instanceof Error) && 
110                                 "iframe succeeded" == res){
111                                 console.debug("OK");
112                         }else{
113                                 console.debug("Error", res);
114                         }                                                               
115                 }
116         });
117 });
118 */
119                 </script>
120         </head>
121         <body>
122
123         </body>
124 </html>