Changeset 7351

Show
Ignore:
Timestamp:
02/18/07 22:19:16 (21 months ago)
Author:
jburke
Message:

(merge from 0.4 branch) References #2366. Converting more tests to use dojo.addOnLoad()

Location:
trunk/tests
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/gfx/test_matrix.html

    r7346 r7351  
    2020}; 
    2121 
    22 dojo.event.connect(dojo, "loaded", function(){ 
     22dojo.addOnLoad(function(){ 
    2323        var m = dojo.gfx.matrix; 
    2424        var a = new m.Matrix2D(); 
  • trunk/tests/io/test_BrowserIO.frag.html

    r3304 r7351  
    1515                        dojo.require("dojo.io.*"); 
    1616 
    17                         onload = function() { 
     17                        dojo.addOnLoad(function(){ 
    1818                                dojo.io.bind({ 
    1919                                        url: "frag.xml", 
     
    2929                                        } 
    3030                                }); 
    31                         } 
     31                        }); 
    3232                </script> 
    3333        </head> 
  • trunk/tests/io/test_BrowserIO.javascript.html

    r1680 r7351  
    3535} 
    3636 
    37 doit(); 
     37dojo.addOnLoad(doit); 
    3838</script> 
    3939</head> 
  • trunk/tests/io/test_BrowserIO.json.html

    r6195 r7351  
    3737} 
    3838 
    39 doit(); 
     39dojo.addOnLoad(doit); 
    4040</script> 
    4141</head> 
  • trunk/tests/io/test_Cookies.html

    r4798 r7351  
    2929} 
    3030 
    31 onload = function() { 
     31dojo.addOnLoad(function() { 
    3232        var ck = dojo.io.cookie; 
    3333        dojo.debug("obj = " + objprops(obj)); 
     
    4040        ck.deleteCookie("foo"); 
    4141        ck.deleteCookie("obj"); 
    42 } 
     42}); 
    4343</script> 
    4444</head> 
  • trunk/tests/io/test_ScriptSrcIO.html

    r3903 r7351  
    2525                 
    2626                var simpleTestPage = "scriptsrc/Test.js"; 
    27                 var transport = dojo.io.ScriptSrcTransport; 
     27                 
     28                dojo.addOnLoad(function(){ 
     29                        //Notice this is a global variable. 
     30                        transport = dojo.io.ScriptSrcTransport; 
     31                }); 
    2832 
    2933                window.onload = function(){ 
  • trunk/tests/lang/test_declare.html

    r6856 r7351  
    1515                dojo.require("dojo.lang.declare"); 
    1616 
    17                 dojo.debug("> dojo.declare('my.classes.foo'..."); 
    18                 dojo.declare('my.classes.foo', null, 
    19                         function(arg) { 
    20                                 dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    21                                 this.id = 'foo'; 
    22                         }, 
    23                         { 
    24                                 getInstanceId: function(extra) { 
    25                                         var ancestorId = my.classes.foo.superclass.getInstanceId.apply(this, arguments); 
    26                                         return "a " + this.id + (ancestorId ? " is " + ancestorId : ''); 
     17                dojo.addOnLoad(function(){ 
     18                        dojo.debug("> dojo.declare('my.classes.foo'..."); 
     19                        dojo.declare('my.classes.foo', null, 
     20                                function(arg) { 
     21                                        dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     22                                        this.id = 'foo'; 
    2723                                }, 
    28                                 getId: function() { 
    29                                         return "I am a foo"; 
     24                                { 
     25                                        getInstanceId: function(extra) { 
     26                                                var ancestorId = my.classes.foo.superclass.getInstanceId.apply(this, arguments); 
     27                                                return "a " + this.id + (ancestorId ? " is " + ancestorId : ''); 
     28                                        }, 
     29                                        getId: function() { 
     30                                                return "I am a foo"; 
     31                                        }, 
     32                                        method: function() { 
     33                                                return "A method in foo"; 
     34                                        } 
     35                                }); 
     36                         
     37                        dojo.debug("> dojo.declare('my.classes.bar', my.classes.foo, ..."); 
     38                        dojo.declare('my.classes.bar', my.classes.foo, 
     39                                function(arg) { 
     40                                        dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     41                                        this.id = 'bar'; 
    3042                                }, 
    31                                 method: function() { 
    32                                         return "A method in foo"; 
    33                                 } 
    34                         }); 
    35                  
    36                 dojo.debug("> dojo.declare('my.classes.bar', my.classes.foo, ..."); 
    37                 dojo.declare('my.classes.bar', my.classes.foo, 
    38                         function(arg) { 
    39                                 dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    40                                 this.id = 'bar'; 
    41                         }, 
    42                         { 
    43                                 getId: function(extra) { 
    44                                         return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); 
    45                                 } 
    46                         }); 
    47                 dojo.debug(''); 
    48                  
    49                 dojo.debug('> b = new my.classes.bar()'); 
    50                 b = new my.classes.bar(); 
    51                 dojo.debug(''); 
    52                  
    53                 dojo.debug("> dojo.declare('my.classes.zot', my.classes.bar, ..."); 
    54                 dojo.declare('my.classes.zot', my.classes.bar, 
    55                         function(arg) { 
    56                                 dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    57                                 this.id = 'zot'; 
    58                         }, 
    59                         { 
    60                                 getId: function(extra) { 
    61                                         return "I am a zot and " + my.classes.zot.superclass.getId.apply(this, arguments); 
    62                                 } 
    63                         }); 
    64                 dojo.debug(''); 
    65                  
    66                 dojo.debug('> f = new my.classes.foo()'); 
    67                 f = new my.classes.foo(); 
    68                 dojo.debug(''); 
    69                  
    70                 dojo.debug('> z = new my.classes.zot("with an argument")'); 
    71                 z = new my.classes.zot("with an argument"); 
    72                 dojo.debug(''); 
    73                  
    74                 dojo.debug('> f.getId()'); 
    75                 dojo.debug(f.getId()); 
    76                 dojo.debug(''); 
    77                  
    78                 dojo.debug('> b.getId()'); 
    79                 dojo.debug(b.getId()); 
    80                 dojo.debug(''); 
    81                  
    82                 dojo.debug('> z.getId()'); 
    83                 dojo.debug(z.getId()); 
    84                 dojo.debug(''); 
    85  
     43                                { 
     44                                        getId: function(extra) { 
     45                                                return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); 
     46                                        } 
     47                                }); 
     48                        dojo.debug(''); 
     49                         
     50                        dojo.debug('> b = new my.classes.bar()'); 
     51                        b = new my.classes.bar(); 
     52                        dojo.debug(''); 
     53                         
     54                        dojo.debug("> dojo.declare('my.classes.zot', my.classes.bar, ..."); 
     55                        dojo.declare('my.classes.zot', my.classes.bar, 
     56                                function(arg) { 
     57                                        dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     58                                        this.id = 'zot'; 
     59                                }, 
     60                                { 
     61                                        getId: function(extra) { 
     62                                                return "I am a zot and " + my.classes.zot.superclass.getId.apply(this, arguments); 
     63                                        } 
     64                                }); 
     65                        dojo.debug(''); 
     66                         
     67                        dojo.debug('> f = new my.classes.foo()'); 
     68                        f = new my.classes.foo(); 
     69                        dojo.debug(''); 
     70                         
     71                        dojo.debug('> z = new my.classes.zot("with an argument")'); 
     72                        z = new my.classes.zot("with an argument"); 
     73                        dojo.debug(''); 
     74                         
     75                        dojo.debug('> f.getId()'); 
     76                        dojo.debug(f.getId()); 
     77                        dojo.debug(''); 
     78                         
     79                        dojo.debug('> b.getId()'); 
     80                        dojo.debug(b.getId()); 
     81                        dojo.debug(''); 
     82                         
     83                        dojo.debug('> z.getId()'); 
     84                        dojo.debug(z.getId()); 
     85                        dojo.debug(''); 
     86                }); 
    8687        </script> 
    8788</head> 
  • trunk/tests/lang/test_declare_mixins.html

    r6856 r7351  
    1515                dojo.require("dojo.lang.declare"); 
    1616 
    17                 dojo.debug("> dojo.declare('my.classes.foo'..."); 
    18                 dojo.declare('my.classes.foo', null,  
    19                         function(arg) { 
    20                                 dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    21                                 this.id = 'foo'; 
    22                         }, { 
    23                         method: function() { 
    24                                 return "A method in foo"; 
    25                         }, 
    26                         method2: function() { 
    27                                 return "Another method in foo"; 
    28                         } 
    29                 }); 
    30  
    31                 dojo.declare('mixinBase', null,  
    32                         function() { 
    33                                 dojo.debug('mixinBase: initializing instance');  
    34                         }, { 
    35                         mixid: "mixinBase", 
    36                         identify: function() { 
    37                                 return "mixinBase"; 
    38                         }, 
    39                         method: function() { 
    40                                 return "A method in mixinBase"; 
    41                         } 
    42                 }); 
    43  
    44                 dojo.declare('mixin', null,  
    45                         function() { 
    46                                 dojo.debug('mixin: initializing instance');  
    47                                 this.mixables = [ ]; 
    48                         }, { 
    49                         mixid: "mixin", 
    50                         identify: function() { 
    51                                 return "mixin"; 
    52                         }, 
    53                         method: function() { 
    54                                 return "A method in mixin"; 
    55                         }, 
    56                         method2: function() { 
    57                                 return "Another method in mixin"; 
    58                         } 
    59                 }); 
    60                                  
    61                 dojo.debug("> dojo.declare('my.classes.bar', [my.classes.foo, mixin]..."); 
    62                 dojo.declare('my.classes.bar', [my.classes.foo, mixin], 
    63                         function(arg) { 
    64                                 dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    65                                 this.id = 'bar'; 
    66                         }, 
    67                         { 
     17                dojo.addOnLoad(function(){ 
     18                        dojo.debug("> dojo.declare('my.classes.foo'..."); 
     19                        dojo.declare('my.classes.foo', null,  
     20                                function(arg) { 
     21                                        dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     22                                        this.id = 'foo'; 
     23                                }, { 
    6824                                method: function() { 
    69                                         return "A method in bar"; 
     25                                        return "A method in foo"; 
     26                                }, 
     27                                method2: function() { 
     28                                        return "Another method in foo"; 
    7029                                } 
    7130                        }); 
    72                  
    73                 dojo.debug("> dojo.declare('my.classes.zot', [null, mixinBase, mixin]..."); 
    74                 dojo.declare('my.classes.zot', [null, mixinBase, mixin], 
    75                         function(arg) { 
    76                                 dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    77                                 this.id = 'zot'; 
    78                         }, 
    79                         { 
     31         
     32                        dojo.declare('mixinBase', null,  
     33                                function() { 
     34                                        dojo.debug('mixinBase: initializing instance');  
     35                                }, { 
     36                                mixid: "mixinBase", 
     37                                identify: function() { 
     38                                        return "mixinBase"; 
     39                                }, 
    8040                                method: function() { 
    81                                         return "A method in zot"; 
     41                                        return "A method in mixinBase"; 
    8242                                } 
    8343                        }); 
    84                  
    85                 dojo.debug('> ------------------------'); 
    86                 dojo.debug('> b = new my.classes.bar()'); 
    87                 b = new my.classes.bar(); 
    88                 dojo.debug('> ------------------------'); 
    89                 dojo.debug('> b.method()'); 
    90                 dojo.debug(b.method()); 
    91                 dojo.debug('> ------------------------'); 
    92                 dojo.debug("> b.identify"); 
    93                 dojo.debug(b.identify()); 
    94                 dojo.debug('> ------------------------'); 
    95                 dojo.debug("> b.method2()"); 
    96                 dojo.debug(b.method2()); 
    97                 dojo.debug('> ------------------------'); 
    98                 dojo.debug("> b.mixid"); 
    99                 dojo.debug(b.mixid); 
    100                 dojo.debug('> ************************'); 
    101                 dojo.debug('> z = new my.classes.zot()'); 
    102                 z = new my.classes.zot(); 
    103                 dojo.debug('> ------------------------'); 
    104                 dojo.debug("> z.mixid"); 
    105                 dojo.debug(z.mixid); 
    106                 dojo.debug('> ------------------------'); 
    107                 dojo.debug("> z.method()"); 
    108                 dojo.debug(z.method()); 
    109                 dojo.debug('> ------------------------'); 
    110                 dojo.debug("> my.mixinBase.prototype.method.call(z)"); 
    111                 dojo.debug(mixinBase.prototype.method.call(z)); 
     44         
     45                        dojo.declare('mixin', null,  
     46                                function() { 
     47                                        dojo.debug('mixin: initializing instance');  
     48                                        this.mixables = [ ]; 
     49                                }, { 
     50                                mixid: "mixin", 
     51                                identify: function() { 
     52                                        return "mixin"; 
     53                                }, 
     54                                method: function() { 
     55                                        return "A method in mixin"; 
     56                                }, 
     57                                method2: function() { 
     58                                        return "Another method in mixin"; 
     59                                } 
     60                        }); 
     61                                         
     62                        dojo.debug("> dojo.declare('my.classes.bar', [my.classes.foo, mixin]..."); 
     63                        dojo.declare('my.classes.bar', [my.classes.foo, mixin], 
     64                                function(arg) { 
     65                                        dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     66                                        this.id = 'bar'; 
     67                                }, 
     68                                { 
     69                                        method: function() { 
     70                                                return "A method in bar"; 
     71                                        } 
     72                                }); 
     73                         
     74                        dojo.debug("> dojo.declare('my.classes.zot', [null, mixinBase, mixin]..."); 
     75                        dojo.declare('my.classes.zot', [null, mixinBase, mixin], 
     76                                function(arg) { 
     77                                        dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     78                                        this.id = 'zot'; 
     79                                }, 
     80                                { 
     81                                        method: function() { 
     82                                                return "A method in zot"; 
     83                                        } 
     84                                }); 
     85                         
     86                        dojo.debug('> ------------------------'); 
     87                        dojo.debug('> b = new my.classes.bar()'); 
     88                        b = new my.classes.bar(); 
     89                        dojo.debug('> ------------------------'); 
     90                        dojo.debug('> b.method()'); 
     91                        dojo.debug(b.method()); 
     92                        dojo.debug('> ------------------------'); 
     93                        dojo.debug("> b.identify"); 
     94                        dojo.debug(b.identify()); 
     95                        dojo.debug('> ------------------------'); 
     96                        dojo.debug("> b.method2()"); 
     97                        dojo.debug(b.method2()); 
     98                        dojo.debug('> ------------------------'); 
     99                        dojo.debug("> b.mixid"); 
     100                        dojo.debug(b.mixid); 
     101                        dojo.debug('> ************************'); 
     102                        dojo.debug('> z = new my.classes.zot()'); 
     103                        z = new my.classes.zot(); 
     104                        dojo.debug('> ------------------------'); 
     105                        dojo.debug("> z.mixid"); 
     106                        dojo.debug(z.mixid); 
     107                        dojo.debug('> ------------------------'); 
     108                        dojo.debug("> z.method()"); 
     109                        dojo.debug(z.method()); 
     110                        dojo.debug('> ------------------------'); 
     111                        dojo.debug("> my.mixinBase.prototype.method.call(z)"); 
     112                        dojo.debug(mixinBase.prototype.method.call(z)); 
     113                }); 
    112114        </script> 
    113115</head> 
  • trunk/tests/lang/test_declare_more.html

    r6138 r7351  
    1515                dojo.require("dojo.lang.declare"); 
    1616 
    17                 dojo.debug('testing expanded usage for dojo.declare'); 
    18                 dojo.debug(''); 
    19                 dojo.debug(''); 
    20                  
    21                 // usually taken care of by dojo.provide 
    22                 dojo.evalObjPath('my.classes', true); 
    23  
    24                 dojo.debug("> dojo.declare('my.classes.foo'..."); 
    25                 // out-of-line initializer declaration 
    26                 my.classes.foo = function(arg) { 
    27                         dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    28                         this.id = 'foo'; 
    29                 } 
    30                 // note array of property objects 
    31                 dojo.declare('my.classes.foo', null, [{ protoId: 'foo' }, { 
    32                                 getId: function() { 
    33                                         return "I am a foo"; 
    34                                 }, 
    35                                 method: function() { 
    36                                         return "A method in foo"; 
     17                dojo.addOnLoad(function(){ 
     18                        dojo.debug('testing expanded usage for dojo.declare'); 
     19                        dojo.debug(''); 
     20                        dojo.debug(''); 
     21                         
     22                        // usually taken care of by dojo.provide 
     23                        dojo.evalObjPath('my.classes', true); 
     24         
     25                        dojo.debug("> dojo.declare('my.classes.foo'..."); 
     26                        // out-of-line initializer declaration 
     27                        my.classes.foo = function(arg) { 
     28                                dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     29                                this.id = 'foo'; 
     30                        } 
     31                        // note array of property objects 
     32                        dojo.declare('my.classes.foo', null, [{ protoId: 'foo' }, { 
     33                                        getId: function() { 
     34                                                return "I am a foo"; 
     35                                        }, 
     36                                        method: function() { 
     37                                                return "A method in foo"; 
     38                                        } 
     39                                }] 
     40                        ); 
     41                         
     42                        dojo.debug("> dojo.declare('my.classes.bar'..."); 
     43                        // out-of-line initializer declaration 
     44                        my.classes.bar = function(arg) { 
     45                                        dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     46                                        this.id = 'bar'; 
     47                        } 
     48                        dojo.declare('my.classes.bar', my.classes.foo, { 
     49                                getId: function(extra) { 
     50                                        return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); 
    3751                                } 
    38                         }] 
    39                 ); 
    40                  
    41                 dojo.debug("> dojo.declare('my.classes.bar'..."); 
    42                 // out-of-line initializer declaration 
    43                 my.classes.bar = function(arg) { 
    44                                 dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    45                                 this.id = 'bar'; 
    46                 } 
    47                 dojo.declare('my.classes.bar', my.classes.foo, { 
    48                         getId: function(extra) { 
    49                                 return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); 
     52                        }); 
     53                        dojo.debug('******'); 
     54                         
     55                        dojo.debug('> b = new my.classes.bar()'); 
     56                        b = new my.classes.bar(); 
     57                        dojo.debug('******'); 
     58                         
     59                        dojo.debug("> dojo.declare('my.classes.zot'..."); 
     60                        // out-of-line initializer declaration 
     61                        my.classes.zot = function(arg) { 
     62                                        dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     63                                        this.id = 'zot'; 
    5064                        } 
     65                        dojo.declare('my.classes.zot', my.classes.bar, { 
     66                                getId: function(extra) { 
     67                                        return "I am a zot and " + my.classes.zot.superclass.getId.apply(this, arguments); 
     68                                } 
     69                        }); 
     70                        dojo.debug('******'); 
     71                         
     72                        dojo.debug('> f = new my.classes.foo()'); 
     73                        f = new my.classes.foo(); 
     74                        dojo.debug('******'); 
     75                         
     76                        dojo.debug('> z = new my.classes.zot("with an argument")'); 
     77                        z = n