source: Dev/trunk/src/client/dojox/io/tests/scriptFrame.html @ 483

Last change on this file since 483 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 2.3 KB
Line 
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 dojox.io.scriptFrame</title>
6                <style type="text/css">
7                        @import "../../../dojo/resources/dojo.css";
8                </style>
9                <script type="text/javascript"
10                        src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
11                <script type="text/javascript">
12                        require(['doh/runner', 'dojo/io/script', 'dojox/io/scriptFrame'], function(doh, script, scriptFrame){
13                                doh.register("t",
14                                        [
15                                                function ioScriptJsonp(t){
16                                                        var d = new doh.Deferred();
17                                                        var td = script.get({
18                                                                //Note that this URL path is relative to the URL of the iframe document
19                                                                //(dojo.moduleUrl("dojo.resources", "blank.html")
20                                                                url: "../tests/io/scriptJsonp.js",
21                                                                content: { foo: "bar" },
22                                                                callbackParamName: "callback",
23                                                                frameDoc: "testFrame"
24                                                        });
25                                                        td.addBoth(function(res){
26                                                                if(!(res instanceof Error) &&
27                                                                        t.is("mammal", res.animalType)){
28                                                                        d.callback(true);
29                                                                }else{
30                                                                        d.errback(false);
31                                                                }
32                                                        });
33                                                        return d;                                                       
34                                                },
35                                                function ioScriptJsonpTimeout(t){
36                                                        var d = new doh.Deferred();
37                                                        var td = script.get({
38                                                                //Note that this URL path is relative to the URL of the iframe document
39                                                                //(dojo.moduleUrl("dojo.resources", "blank.html")
40                                                                url: "../tests/_base/timeout.php",
41                                                                callbackParamName: "callback",
42                                                                content: {Foo: 'Bar'},
43                                                                timeout: 500,
44                                                                handleAs: "json",
45                                                                preventCache: true,
46                                                                handle: function(response, ioArgs){
47                                                                        if(response instanceof Error && response.dojoType == "timeout"){
48                                                                                console.debug("FOO OK TEST");
49                                                                                d.callback(true);
50                                                                        }else{
51                                                                                console.debug("FOO FAIL TEST");
52                                                                                d.errback(false);
53                                                                        }
54                                                                },
55                                                                frameDoc: "testFrame"
56                                                        });
57                                                        return d;
58                                                }
59                                        ]
60                                );
61                                doh.run();
62                        });
63
64/*
65                        dojo.addOnLoad(function(){
66                                td = dojo.io.script.get({
67                                        url: "scriptSimple.js",
68                                        checkString: "myTasks"
69                                });
70                                td.addCallback(function(res){
71                                        alert(myTasks);
72                                        alert(myTasks[1]);
73                                        if(typeof(myTasks) != "undefined"
74                                                && "Do dishes." == myTasks[1]){
75                                                alert("yeah");
76                                        }else{
77                                                alert("boo");
78                                        }
79                                });
80                        });
81*/
82
83                </script>
84        </head>
85        <body>
86
87        </body>
88</html>
Note: See TracBrowser for help on using the repository browser.