Changeset 7350

Show
Ignore:
Timestamp:
02/18/07 22:11:39 (18 months ago)
Author:
jburke
Message:

References #2366. Converting more tests to use dojo.addOnLoad()

Location:
branches/0.4/tests
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • branches/0.4/tests/gfx/test_matrix.html

    r5507 r7350  
    2020}; 
    2121 
    22 dojo.event.connect(dojo, "loaded", function(){ 
     22dojo.addOnLoad(function(){ 
    2323        var a = new dojo.gfx.matrix.Matrix2D(); 
    2424        mdebug(a); 
  • branches/0.4/tests/graphics/test_color.html

    r3994 r7350  
    2121dojo.require("dojo.graphics.color.hsl"); 
    2222 
    23 var c = dojo.graphics.color; 
    24 var hex = ["#003399", "#039", "003399", "039"]; 
    25 for(var i = 0; i < hex.length; i++) { 
    26         var rgb = c.hex2rgb(hex[i]); 
    27         dojo.debug(hex[i], "-> hex2rgb ->", rgb, "-> rgb2hex ->", c.rgb2hex(rgb)); 
    28         dojo.debug("extractRGB(" + hex[i] + ")", c.extractRGB(hex[i])); 
    29 } 
    30  
    31 dojo.debug(); 
    32 dojo.debug("Color object:"); 
    33 var color = new dojo.graphics.color.Color("ffc"); 
    34 dojo.debug("toRgb:", color.toRgb()); 
    35 dojo.debug("toHex:", color.toHex()); 
    36 dojo.debug("toCss:", color.toCss()); 
    37 dojo.debug("toString:", color.toString()); 
    38 dojo.debug("toHsv:", color.toHsv()); 
    39 dojo.debug("toHsl:", color.toHsl()); 
    40  
    41 dojo.debug(); 
    42 dojo.debug("Named colors:"); 
    43 for(var clr in c.named) { 
    44         var rgb = c.extractRGB(clr); 
    45         dojo.debug(clr, "->", rgb, "->", c.rgb2hex(rgb)); 
    46 } 
    47  
    48  
    49 dojo.debug(); 
    50 dojo.debug("Color spaces:"); 
    51  
    52 var a = [255,255,204]; 
    53 var b = dojo.graphics.color.rgb2hsv(a); 
    54 var c = dojo.graphics.color.hsv2rgb(b); 
    55 dojo.debug("HSV:", a, "->", b, "->", c); 
    56  
    57 var d = [255,255,204]; 
    58 var e = dojo.graphics.color.rgb2hsl(d); 
    59 var f = dojo.graphics.color.hsl2rgb(e); 
    60 dojo.debug("HSL:", d, "->", e, "->", f); 
    61  
    62  
    63 dojo.debug(); 
    64 dojo.debug("String handling:"); 
    65  
    66 dojo.debug('Hex from rgb(100,100,100): ' + new dojo.graphics.color.Color('rgb(100,100,100)').toHex()); 
    67 dojo.debug('Hex from rgb(255,0,128): ' + new dojo.graphics.color.Color('rgb(255,0,128)').toHex()); 
    68  
     23dojo.addOnLoad(function(){ 
     24        var c = dojo.graphics.color; 
     25        var hex = ["#003399", "#039", "003399", "039"]; 
     26        for(var i = 0; i < hex.length; i++) { 
     27                var rgb = c.hex2rgb(hex[i]); 
     28                dojo.debug(hex[i], "-> hex2rgb ->", rgb, "-> rgb2hex ->", c.rgb2hex(rgb)); 
     29                dojo.debug("extractRGB(" + hex[i] + ")", c.extractRGB(hex[i])); 
     30        } 
     31         
     32        dojo.debug(); 
     33        dojo.debug("Color object:"); 
     34        var color = new dojo.graphics.color.Color("ffc"); 
     35        dojo.debug("toRgb:", color.toRgb()); 
     36        dojo.debug("toHex:", color.toHex()); 
     37        dojo.debug("toCss:", color.toCss()); 
     38        dojo.debug("toString:", color.toString()); 
     39        dojo.debug("toHsv:", color.toHsv()); 
     40        dojo.debug("toHsl:", color.toHsl()); 
     41         
     42        dojo.debug(); 
     43        dojo.debug("Named colors:"); 
     44        for(var clr in c.named) { 
     45                var rgb = c.extractRGB(clr); 
     46                dojo.debug(clr, "->", rgb, "->", c.rgb2hex(rgb)); 
     47        } 
     48         
     49         
     50        dojo.debug(); 
     51        dojo.debug("Color spaces:"); 
     52         
     53        var a = [255,255,204]; 
     54        var b = dojo.graphics.color.rgb2hsv(a); 
     55        var c = dojo.graphics.color.hsv2rgb(b); 
     56        dojo.debug("HSV:", a, "->", b, "->", c); 
     57         
     58        var d = [255,255,204]; 
     59        var e = dojo.graphics.color.rgb2hsl(d); 
     60        var f = dojo.graphics.color.hsl2rgb(e); 
     61        dojo.debug("HSL:", d, "->", e, "->", f); 
     62         
     63         
     64        dojo.debug(); 
     65        dojo.debug("String handling:"); 
     66         
     67        dojo.debug('Hex from rgb(100,100,100): ' + new dojo.graphics.color.Color('rgb(100,100,100)').toHex()); 
     68        dojo.debug('Hex from rgb(255,0,128): ' + new dojo.graphics.color.Color('rgb(255,0,128)').toHex()); 
     69}); 
    6970</script> 
    7071</head> 
  • branches/0.4/tests/io/test_BrowserIO.frag.html

    r3304 r7350  
    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> 
  • branches/0.4/tests/io/test_BrowserIO.javascript.html

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

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

    r4798 r7350  
    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> 
  • branches/0.4/tests/io/test_ScriptSrcIO.html

    r3903 r7350  
    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(){ 
  • branches/0.4/tests/lang/test_declare.html

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

    r6163 r7350  
    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                         } 
     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                                }, { 
     24                                method: function() { 
     25                                        return "A method in foo"; 
     26                                }, 
     27                                method2: function() { 
     28                                        return "Another method in foo"; 
     29                                } 
     30                        }); 
     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                                }, 
     40                                method: function() { 
     41                                        return "A method in mixinBase"; 
     42                                } 
     43                        }); 
     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                                initializer: function(arg) { 
     65                                        dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     66                                        this.id = 'bar'; 
     67                                }, 
     68                                method: function() { 
     69                                        return "A method in bar"; 
     70                                } 
     71                        }); 
     72                         
     73                        dojo.debug("> dojo.declare('my.classes.zot', [null, mixinBase, mixin]..."); 
     74                        dojo.declare('my.classes.zot', [null, mixinBase, mixin], { 
     75                                initializer: function(arg) { 
     76                                        dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
     77                                        this.id = 'zot'; 
     78                                }, 
     79                                method: function() { 
     80                                        return "A method in zot"; 
     81                                } 
     82                        }); 
     83                         
     84                        dojo.debug('> ------------------------'); 
     85                        dojo.debug('> b = new my.classes.bar()'); 
     86                        b = new my.classes.bar(); 
     87                        dojo.debug('> ------------------------'); 
     88                        dojo.debug('> b.method()'); 
     89                        dojo.debug(b.method()); 
     90                        dojo.debug('> ------------------------'); 
     91                        dojo.debug("> b.identify"); 
     92                        dojo.debug(b.identify()); 
     93                        dojo.debug('> ------------------------'); 
     94                        dojo.debug("> b.method2()"); 
     95                        dojo.debug(b.method2()); 
     96                        dojo.debug('> ------------------------'); 
     97                        dojo.debug("> b.mixid"); 
     98                        dojo.debug(b.mixid); 
     99                        dojo.debug('> ************************'); 
     100                        dojo.debug('> z = new my.classes.zot()'); 
     101                        z = new my.classes.zot(); 
     102                        dojo.debug('> ------------------------'); 
     103                        dojo.debug("> z.mixid"); 
     104                        dojo.debug(z.mixid); 
     105                        dojo.debug('> ------------------------'); 
     106                        dojo.debug("> z.method()"); 
     107                        dojo.debug(z.method()); 
     108                        dojo.debug('> ------------------------'); 
     109                        dojo.debug("> my.mixinBase.prototype.method.call(z)"); 
     110                        dojo.debug(mixinBase.prototype.method.call(z)); 
    29111                }); 
    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                         initializer: function(arg) { 
    64                                 dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    65                                 this.id = 'bar'; 
    66                         }, 
    67                         method: function() { 
    68                                 return "A method in bar"; 
    69                         } 
    70                 }); 
    71                  
    72                 dojo.debug("> dojo.declare('my.classes.zot', [null, mixinBase, mixin]..."); 
    73                 dojo.declare('my.classes.zot', [null, mixinBase, mixin], { 
    74                         initializer: function(arg) { 
    75                                 dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : ''));  
    76                                 this.id = 'zot'; 
    77                         }, 
    78                         method: function() { 
    79                                 return "A method in zot"; 
    80                         } 
    81                 }); 
    82                  
    83                 dojo.debug('> ------------------------'); 
    84                 dojo.debug('> b = new my.classes.bar()'); 
    85                 b = new my.classes.bar(); 
    86                 dojo.debug('> ------------------------'); 
    87                 dojo.debug('> b.method()'); 
    88                 dojo.debug(b.method()); 
    89                 dojo.debug('> ------------------------'); 
    90                 dojo.debug("> b.identify"); 
    91                 dojo.debug(b.identify()); 
    92                 dojo.debug('> ------------------------'); 
    93                 dojo.debug("> b.method2()"); 
    94                 dojo.debug(b.method2()); 
    95                 dojo.debug('> ------------------------'); 
    96                 dojo.debug("> b.mixid"); 
    97                 dojo.debug(b.mixid); 
    98                 dojo.debug('> ************************'); 
    99                 dojo.debug('> z = new my.classes.zot()'); 
    100                 z = new my.classes.zot(); 
    101                 dojo.debug('> ------------------------'); 
    102                 dojo.debug("> z.mixid"); 
    103                 dojo.debug(z.mixid); 
    104                 dojo.debug('> ------------------------'); 
    105                 dojo.debug("> z.method()"); 
    106                 dojo.debug(z.method()); 
    107                 dojo.debug('> ------------------------'); 
    108                 dojo.debug("> my.mixinBase.prototype.method.call(z)"); 
    109                 dojo.debug(mixinBase.prototype.method.call(z)); 
    110112        </script> 
    111113</head> 
  • branches/0.4/tests/lang/test_declare_more.html

    r6138 r7350  
    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