1 if(!dojo._hasResource["tests._base.declare"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["tests._base.declare"] = true;
3 dojo.provide("tests._base.declare");
5 tests.register("tests._base.declare",
8 dojo.declare("tests._base.declare.tmp");
9 var tmp = new tests._base.declare.tmp();
10 dojo.declare("testsFoo");
11 var tmp = new testsFoo();
13 function smokeTest2(t){
14 dojo.declare("tests._base.declare.foo", null, {
17 var tmp = new tests._base.declare.foo();
18 t.is("thonk", tmp.foo);
20 dojo.declare("testsFoo2", null, {
23 var tmp2 = new testsFoo2();
24 t.is("thonk", tmp2.foo);
26 function smokeTestWithCtor(t){
27 dojo.declare("tests._base.declare.fooBar", null, {
28 constructor: function(){
33 var tmp = new tests._base.declare.fooBar();
34 t.is("blah", tmp.foo);
36 function smokeTestCompactArgs(t){
37 dojo.declare("tests._base.declare.fooBar2", null, {
40 var tmp = new tests._base.declare.fooBar2();
41 t.is("thonk", tmp.foo);
44 dojo.declare("tests._base.declare.tmp3", null, {
47 dojo.declare("tests._base.declare.tmp4", tests._base.declare.tmp3);
48 var tmp = new tests._base.declare.tmp4();
49 t.is("thonk", tmp.foo);
51 function subclassWithCtor(t){
52 dojo.declare("tests._base.declare.tmp5", null, {
53 constructor: function(){
58 dojo.declare("tests._base.declare.tmp6", tests._base.declare.tmp5);
59 var tmp = new tests._base.declare.tmp6();
60 t.is("blah", tmp.foo);
62 function mixinSubclass(t){
63 dojo.declare("tests._base.declare.tmp7", null, {
66 dojo.declare("tests._base.declare.tmp8", null, {
67 constructor: function(){
71 var tmp = new tests._base.declare.tmp8();
72 t.is("blah", tmp.foo);
73 dojo.declare("tests._base.declare.tmp9",
75 tests._base.declare.tmp7, // prototypal
76 tests._base.declare.tmp8 // mixin
78 var tmp2 = new tests._base.declare.tmp9();
79 t.is("blah", tmp2.foo);
81 function superclassRef(t){
82 dojo.declare("tests._base.declare.tmp10", null, {
85 dojo.declare("tests._base.declare.tmp11", tests._base.declare.tmp10, {
86 constructor: function(){
90 var tmp = new tests._base.declare.tmp11();
91 t.is("blah", tmp.foo);
92 t.is("thonk", tests._base.declare.tmp11.superclass.foo);
94 function inheritedCall(t){
96 dojo.declare("tests._base.declare.tmp12", null, {
98 bar: function(arg1, arg2){
107 dojo.declare("tests._base.declare.tmp13", tests._base.declare.tmp12, {
108 constructor: function(){
112 var tmp = new tests._base.declare.tmp13();
113 t.is("blah", tmp.foo);
116 t.is("zot", tmp.foo);
118 tmp.bar("trousers", "squiggle");
119 t.is("trousers", tmp.foo);
120 t.is("squiggle", foo);
122 function inheritedExplicitCall(t){
124 dojo.declare("tests._base.declare.tmp14", null, {
126 bar: function(arg1, arg2){
135 dojo.declare("tests._base.declare.tmp15", tests._base.declare.tmp14, {
136 constructor: function(){
139 bar: function(arg1, arg2){
140 this.inherited("bar", arguments, [arg2, arg1]);
142 baz: function(arg1, arg2){
143 tests._base.declare.tmp15.superclass.bar.apply(this, arguments);
146 var tmp = new tests._base.declare.tmp15();
147 t.is("blah", tmp.foo);
150 t.is("zot", tmp.foo);
152 tmp.bar("trousers", "squiggle");
153 t.is("squiggle", tmp.foo);
154 t.is("trousers", foo);
156 function inheritedMixinCalls(t){
157 dojo.declare("tests._base.declare.tmp16", null, {
163 dojo.declare("tests._base.declare.mixin16", null, {
165 this.inherited(arguments);
166 this.foo += ".mixin16";
169 dojo.declare("tests._base.declare.mixin17", tests._base.declare.mixin16, {
171 this.inherited(arguments);
172 this.foo += ".mixin17";
175 dojo.declare("tests._base.declare.tmp17", [tests._base.declare.tmp16, tests._base.declare.mixin17], {
177 this.inherited(arguments);
178 this.foo += ".tmp17";
181 var tmp = new tests._base.declare.tmp17();
183 t.is("tmp16.mixin16.mixin17.tmp17", tmp.foo);
185 function mixinPreamble(t){
187 dojo.declare("tests._base.declare.tmp16");
188 new tests._base.declare.tmp16({ preamble: function(){ passed = true; } });
191 // FIXME: there are still some permutations to test like:
193 // - multi-level inheritance + L/R conflict checks