[483] | 1 | dojo.provide("util.docscripts.tests.simple"); |
---|
| 2 | /*===== |
---|
| 3 | util.docscripts.tests.simple = { |
---|
| 4 | // summary: Module level summary |
---|
| 5 | }; |
---|
| 6 | =====*/ |
---|
| 7 | dojo.require("dojo.cookie"); |
---|
| 8 | (function(d, $){ |
---|
| 9 | |
---|
| 10 | d.thisIsAtestFunction = function(/* String */a){ |
---|
| 11 | // summary: Testing a function |
---|
| 12 | // a: String |
---|
| 13 | // Testing a string parameter |
---|
| 14 | return a.toUpperCase(); // String |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | d.testFunction2 = function(/* String? */id){ |
---|
| 18 | // summary: Simple summary |
---|
| 19 | // description: |
---|
| 20 | // Simple Description. |
---|
| 21 | // On Multiple lines. |
---|
| 22 | // id: String? |
---|
| 23 | // Duplicate matched in signature and in line |
---|
| 24 | // returns: String |
---|
| 25 | // Whatever |
---|
| 26 | return (id || "").toUpperCase(); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | d.declare("dojo.FooBar", null, { |
---|
| 30 | // summary: A Class |
---|
| 31 | // description: A Class description |
---|
| 32 | // example: |
---|
| 33 | // | This is a test |
---|
| 34 | // |
---|
| 35 | // member: Integer |
---|
| 36 | // Used for counting things |
---|
| 37 | member: 0, |
---|
| 38 | |
---|
| 39 | memberFn: function(a, b, c){ |
---|
| 40 | // summary: A member function |
---|
| 41 | // a: String |
---|
| 42 | // b: String |
---|
| 43 | // c: Boolean? |
---|
| 44 | return 10; // Integer |
---|
| 45 | }, |
---|
| 46 | |
---|
| 47 | constructor: function(args){ |
---|
| 48 | // summary: The constructor. |
---|
| 49 | dojo.mixin(this, args); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | }); |
---|
| 53 | |
---|
| 54 | d.declare("dojo.FooBar2", dojo.FooBar, { |
---|
| 55 | // inheritance: String |
---|
| 56 | // Checking declare mixins |
---|
| 57 | inheritance:"rules" |
---|
| 58 | }); |
---|
| 59 | |
---|
| 60 | d.mixin(d, { |
---|
| 61 | |
---|
| 62 | // mixedValue: Integer |
---|
| 63 | // External doc block, mixed |
---|
| 64 | mixedValue: 10, |
---|
| 65 | |
---|
| 66 | mixedFunction: function(a){ |
---|
| 67 | // summary: From mixin |
---|
| 68 | // a: Integer? |
---|
| 69 | // Some number or not |
---|
| 70 | return a * 10; // Integer |
---|
| 71 | } |
---|
| 72 | }); |
---|
| 73 | |
---|
| 74 | d.extend(d.FooBar, { |
---|
| 75 | |
---|
| 76 | // extendedMember: Integer |
---|
| 77 | // External doc block, extended |
---|
| 78 | extendedMember: 10, |
---|
| 79 | |
---|
| 80 | secondMember: function(a, b, c){ |
---|
| 81 | // summary: Another member function |
---|
| 82 | // a: String? |
---|
| 83 | // b: String? |
---|
| 84 | // c: Boolean? |
---|
| 85 | // returns: String |
---|
| 86 | // Some return description text. |
---|
| 87 | return "Hello, World"; |
---|
| 88 | } |
---|
| 89 | }); |
---|
| 90 | |
---|
| 91 | /*===== |
---|
| 92 | util.docscripts.tests.simple.__kwArgs = function(a, b, c){ |
---|
| 93 | // summary: Simple kwarg definition |
---|
| 94 | // a: String |
---|
| 95 | // b: Integer |
---|
| 96 | // c: Boolean? |
---|
| 97 | this.a = a; |
---|
| 98 | this.b = b; |
---|
| 99 | this.c = c; |
---|
| 100 | }; |
---|
| 101 | =====*/ |
---|
| 102 | |
---|
| 103 | d.kwArgFunction = function(/* util.docscripts.tests.simple.__kwArgs */args){ |
---|
| 104 | // summary: kwarg function test |
---|
| 105 | // returns: String |
---|
| 106 | return "winning."; |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | $.stub = function(a, b){ |
---|
| 110 | // summary: aliased to `dojo.query` |
---|
| 111 | return a * b; // Integer |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | d.returner = function(a){ |
---|
| 115 | // summary: Simple returner check |
---|
| 116 | // a: String|Integer |
---|
| 117 | // Multiple types for param |
---|
| 118 | // returns: String|Integer |
---|
| 119 | // This should be description |
---|
| 120 | return a; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | d.multiReturns = function(a){ |
---|
| 124 | // summary: Simple multireturn check |
---|
| 125 | if(a > 10){ |
---|
| 126 | return "A"; // String |
---|
| 127 | }else{ |
---|
| 128 | return 10; // Integer |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | })(dojo, dojo.query); |
---|