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

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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>