extjs-mvc 0.4.0.f → 0.4.0.g
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bin/extjs-mvc +0 -3
- data/lib/extjs-mvc.rb +10 -6
- data/lib/extjs-mvc/api.rb +0 -1
- metadata +8 -84
- data/lib/src/App.js +0 -219
- data/lib/src/MVC.js +0 -260
- data/lib/src/Presenter.js +0 -52
- data/lib/src/README.rdoc +0 -69
- data/lib/src/controller/Controller.js +0 -278
- data/lib/src/controller/CrudController.js +0 -460
- data/lib/src/lib/Array.js +0 -26
- data/lib/src/lib/Booter.js +0 -416
- data/lib/src/lib/ClassManager.js +0 -191
- data/lib/src/lib/ControllerClassManager.js +0 -95
- data/lib/src/lib/Dependencies.js +0 -44
- data/lib/src/lib/DispatchMatcher.js +0 -98
- data/lib/src/lib/Dispatcher.js +0 -129
- data/lib/src/lib/Environment.js +0 -43
- data/lib/src/lib/Inflector.js +0 -155
- data/lib/src/lib/ModelClassManager.js +0 -19
- data/lib/src/lib/Route.js +0 -139
- data/lib/src/lib/Router.js +0 -282
- data/lib/src/lib/String.js +0 -94
- data/lib/src/lib/ViewClassManager.js +0 -229
- data/lib/src/lib/notes.txt +0 -32
- data/lib/src/model/AdapterManager.js +0 -30
- data/lib/src/model/Association.js +0 -26
- data/lib/src/model/Base.js +0 -63
- data/lib/src/model/BelongsToAssociation.js +0 -116
- data/lib/src/model/Cache.js +0 -131
- data/lib/src/model/HasManyAssociation.js +0 -160
- data/lib/src/model/Model.js +0 -331
- data/lib/src/model/UrlBuilder.js +0 -106
- data/lib/src/model/adapters/AbstractAdapter.js +0 -296
- data/lib/src/model/adapters/MemoryAdapter.js +0 -103
- data/lib/src/model/adapters/RESTAdapter.js +0 -345
- data/lib/src/model/adapters/RESTJSONAdapter.js +0 -68
- data/lib/src/model/adapters/notes.txt +0 -42
- data/lib/src/model/associations/Association.js +0 -192
- data/lib/src/model/associations/notes.txt +0 -87
- data/lib/src/model/validations/Errors.js +0 -136
- data/lib/src/model/validations/Plugin.js +0 -139
- data/lib/src/model/validations/Validations.js +0 -276
- data/lib/src/notes/Charts.graffle +0 -0
- data/lib/src/overrides/Ext.Component.js +0 -21
- data/lib/src/overrides/Ext.extend.js +0 -142
- data/lib/src/spec/Array.spec.js +0 -15
- data/lib/src/spec/ExtMVC.spec.js +0 -65
- data/lib/src/spec/Model.spec.js +0 -370
- data/lib/src/spec/OS.spec.js +0 -83
- data/lib/src/spec/Router.spec.js +0 -99
- data/lib/src/spec/SpecHelper.js +0 -106
- data/lib/src/spec/String.spec.js +0 -83
- data/lib/src/spec/model/AbstractAdapter.spec.js +0 -49
- data/lib/src/spec/model/Associations.spec.js +0 -99
- data/lib/src/spec/model/Cache.spec.js +0 -5
- data/lib/src/spec/model/RESTAdapter.spec.js +0 -19
- data/lib/src/spec/model/ValidationErrors.spec.js +0 -64
- data/lib/src/spec/model/Validations.spec.js +0 -166
- data/lib/src/spec/model/ValidationsPlugin.spec.js +0 -108
- data/lib/src/spec/suite.html +0 -60
- data/lib/src/specs-old/JSSpec.css +0 -216
- data/lib/src/specs-old/JSSpec.js +0 -1512
- data/lib/src/specs-old/all.html +0 -66
- data/lib/src/specs-old/base.js +0 -14
- data/lib/src/specs-old/controller.js +0 -17
- data/lib/src/specs-old/diff_match_patch.js +0 -1
- data/lib/src/specs-old/model.js +0 -70
- data/lib/src/specs-old/route.js +0 -38
- data/lib/src/specs-old/router.js +0 -59
- data/lib/src/specs-old/string.js +0 -22
- data/lib/src/testrunner/JSpecFormatter.js +0 -111
- data/lib/src/testrunner/TestClient.js +0 -181
- data/lib/src/testrunner/TestGrid.js +0 -351
- data/lib/src/testrunner/TestRunner.js +0 -110
- data/lib/src/testrunner/TestViewport.js +0 -94
- data/lib/src/vendor.yml +0 -29
- data/lib/src/vendor/ext-3.1.1/vendor.yml +0 -16
- data/lib/src/view/FormWindow.js +0 -184
- data/lib/src/view/HasManyEditorGridPanel.js +0 -211
- data/lib/src/view/scaffold/Edit.js +0 -46
- data/lib/src/view/scaffold/Index.js +0 -561
- data/lib/src/view/scaffold/New.js +0 -20
- data/lib/src/view/scaffold/ScaffoldFormPanel.js +0 -255
@@ -1,276 +0,0 @@
|
|
1
|
-
Ext.ns('ExtMVC.model.plugin.validation');
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @ignore
|
5
|
-
* The Validation classes themselves are defined here.
|
6
|
-
* Subclass ExtMVC.model.plugin.validation.AbstractValidation to create your own validations
|
7
|
-
*/
|
8
|
-
|
9
|
-
/**
|
10
|
-
* @class ExtMVC.model.plugin.validation.AbstractValidation
|
11
|
-
* Base class for all validations - not used directly, but any of the following may be used:
|
12
|
-
<pre><code>
|
13
|
-
ExtMVC.model.define("SomeModel", {
|
14
|
-
fields: [
|
15
|
-
{name: 'title', type: 'string'},
|
16
|
-
{name: 'price', type: 'int'},
|
17
|
-
{name: 'stock', type: 'int'},
|
18
|
-
{name: 'gender', type: 'string'},
|
19
|
-
{name: 'colour', type: 'string'}
|
20
|
-
],
|
21
|
-
|
22
|
-
validatesPresenceOf : ["title", "price"],
|
23
|
-
validatesLengthOf : {field: 'title', minimum: 3, maximum: 12},
|
24
|
-
|
25
|
-
validatesInclusionOf: {field: 'gender', allowed : ["Male", "Female"]},
|
26
|
-
validatesExclusionOf: {field: 'colour', disallowed: ["Red"]},
|
27
|
-
validatesFormatOf : {field: 'email', regex: /someRegex/},
|
28
|
-
|
29
|
-
validatesNumericalityOf: "stock"
|
30
|
-
});
|
31
|
-
</code></pre>
|
32
|
-
*
|
33
|
-
* Most validations will allow an array to be passed to set the validation up on more than one field (e.g.
|
34
|
-
* see the validatesPresenceOf declaration above). If only a string is provided it is assume to be the field name.
|
35
|
-
* The following are all equivalent:
|
36
|
-
<pre><code>
|
37
|
-
validatesPresenceOf: "title"
|
38
|
-
validatesPresenceOf: ["title"]
|
39
|
-
validatesPresenceOf: {field: "title"}
|
40
|
-
validatesPresenceOf: [{field: "title"}]
|
41
|
-
</code></pre>
|
42
|
-
*
|
43
|
-
* <h2>Running validations</h2>
|
44
|
-
* This plugin overrides ExtMVC.model.Base's usual isValid() function to provide feedback from the validations:
|
45
|
-
*
|
46
|
-
<pre><code>
|
47
|
-
var user = new SomeModel({title: "A really long title", colour: "Blue"});
|
48
|
-
user.isValid(); //returns false if any of the validations failed
|
49
|
-
user.errors; //returns an {@link ExtMVC.model.plugin.validation.Errors Errors} object
|
50
|
-
</code></pre>
|
51
|
-
*/
|
52
|
-
ExtMVC.model.plugin.validation.AbstractValidation = function(ownerClass, field, config) {
|
53
|
-
this.ownerClass = ownerClass;
|
54
|
-
this.field = field;
|
55
|
-
|
56
|
-
Ext.apply(this, config);
|
57
|
-
};
|
58
|
-
|
59
|
-
ExtMVC.model.plugin.validation.AbstractValidation.prototype = {
|
60
|
-
/**
|
61
|
-
* Returns the current value of the field to which this validation applies
|
62
|
-
* @param {ExtMVC.model.Base} instance The model instance to get the value from
|
63
|
-
* @return {Mixed} The current value of the field
|
64
|
-
*/
|
65
|
-
getValue: function(instance) {
|
66
|
-
return instance.get(this.field);
|
67
|
-
},
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Empty function which must be overridden by a validation subclass. Make your function return
|
71
|
-
* true if the validation passes, false otherwise
|
72
|
-
* @return {Boolean} True if this validation passes
|
73
|
-
*/
|
74
|
-
isValid: function(instance) {
|
75
|
-
return true;
|
76
|
-
}
|
77
|
-
};
|
78
|
-
|
79
|
-
/**
|
80
|
-
* @class ExtMVC.model.plugin.validation.ValidatesPresenceOf
|
81
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
82
|
-
* Ensures that a field is present. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
83
|
-
*/
|
84
|
-
ExtMVC.model.plugin.validation.ValidatesPresenceOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
85
|
-
/**
|
86
|
-
* @property message
|
87
|
-
* @type String
|
88
|
-
* The textual message returned if this validation didn't pass
|
89
|
-
*/
|
90
|
-
message: 'must be present',
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Returns true if the field is an object or a non-empty string
|
94
|
-
* @return {Boolean} True if the field is present
|
95
|
-
*/
|
96
|
-
isValid: function(instance) {
|
97
|
-
var value = this.getValue(instance),
|
98
|
-
valid = false;
|
99
|
-
|
100
|
-
switch(typeof value) {
|
101
|
-
case 'object': if (value != null) valid = true; break;
|
102
|
-
case 'string': if (value.length != 0) valid = true; break;
|
103
|
-
};
|
104
|
-
|
105
|
-
return valid;
|
106
|
-
}
|
107
|
-
});
|
108
|
-
|
109
|
-
/**
|
110
|
-
* @class ExtMVC.model.plugin.validation.ValidatesLengthOf
|
111
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
112
|
-
* Returns true if the field is within the length bounds imposed. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
113
|
-
*/
|
114
|
-
ExtMVC.model.plugin.validation.ValidatesLengthOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
115
|
-
|
116
|
-
/**
|
117
|
-
* @property tooShortMessage
|
118
|
-
* @type String
|
119
|
-
* The message returned if this field was too short
|
120
|
-
*/
|
121
|
-
tooShortMessage: 'is too short',
|
122
|
-
|
123
|
-
/**
|
124
|
-
* @property tooLongMessage
|
125
|
-
* @type String
|
126
|
-
* The message returned if this field was too long
|
127
|
-
*/
|
128
|
-
tooLongMessage: 'is too long',
|
129
|
-
|
130
|
-
message: '',
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Tests that the mimimum and maximum length of this field are met.
|
134
|
-
* Intended to be used on strings and arrays
|
135
|
-
* @return {Boolean} True if the conditions are met
|
136
|
-
*/
|
137
|
-
isValid: function(instance) {
|
138
|
-
var value = this.getValue(instance);
|
139
|
-
|
140
|
-
if (typeof value == 'undefined') return true;
|
141
|
-
|
142
|
-
if (this.minimum && value.length < this.minimum) {
|
143
|
-
this.message = this.tooShortMessage;
|
144
|
-
return false;
|
145
|
-
}
|
146
|
-
|
147
|
-
if (this.maximum & value.length > this.maximum) {
|
148
|
-
this.message = this.tooLongMessage;
|
149
|
-
return false;
|
150
|
-
}
|
151
|
-
|
152
|
-
return true;
|
153
|
-
}
|
154
|
-
});
|
155
|
-
|
156
|
-
/**
|
157
|
-
* @class ExtMVC.model.plugin.validation.ValidatesNumericalityOf
|
158
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
159
|
-
* Ensures that the field is a number. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
160
|
-
*/
|
161
|
-
ExtMVC.model.plugin.validation.ValidatesNumericalityOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
162
|
-
/**
|
163
|
-
* @property message
|
164
|
-
* @type String
|
165
|
-
* The message returned if this field is not a number
|
166
|
-
*/
|
167
|
-
message: 'must be a number',
|
168
|
-
|
169
|
-
/**
|
170
|
-
* Returns true if the typeof this field is a number
|
171
|
-
* @return {Boolean} True if this is a number
|
172
|
-
*/
|
173
|
-
isValid: function(instance) {
|
174
|
-
return 'number' == typeof this.getValue(instance);
|
175
|
-
}
|
176
|
-
});
|
177
|
-
|
178
|
-
/**
|
179
|
-
* @class ExtMVC.model.plugin.validation.ValidatesInclusionOf
|
180
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
181
|
-
* Ensures that the field is one of the allowed values. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
182
|
-
*/
|
183
|
-
ExtMVC.model.plugin.validation.ValidatesInclusionOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
184
|
-
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Override Abstract constructor to build the validation message
|
188
|
-
*/
|
189
|
-
constructor: function(m, f, config) {
|
190
|
-
//set up defaults
|
191
|
-
config = config || {};
|
192
|
-
Ext.applyIf(config, { allowed: [] });
|
193
|
-
|
194
|
-
ExtMVC.model.plugin.validation.ValidatesInclusionOf.superclass.constructor.call(this, m, f, config);
|
195
|
-
|
196
|
-
Ext.applyIf(this, {
|
197
|
-
message: 'must be one of ' + this.allowed.toSentence('or')
|
198
|
-
});
|
199
|
-
},
|
200
|
-
|
201
|
-
/**
|
202
|
-
* Returns true if the value of this field is one of those specified in this.allowed
|
203
|
-
* @return {Boolean} True if the field's value is allowed
|
204
|
-
*/
|
205
|
-
isValid: function(instance) {
|
206
|
-
var value = this.getValue(instance);
|
207
|
-
|
208
|
-
for (var i=0; i < this.allowed.length; i++) {
|
209
|
-
if (this.allowed[i] == value) return true;
|
210
|
-
};
|
211
|
-
|
212
|
-
return false;
|
213
|
-
}
|
214
|
-
});
|
215
|
-
|
216
|
-
/**
|
217
|
-
* @class ExtMVC.model.plugin.validation.ValidatesExclusionOf
|
218
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
219
|
-
* Ensures that the field is not one of the allowed values. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
220
|
-
*/
|
221
|
-
ExtMVC.model.plugin.validation.ValidatesExclusionOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
222
|
-
|
223
|
-
/**
|
224
|
-
* Override Abstract constructor to build the validation message
|
225
|
-
* @ignore
|
226
|
-
*/
|
227
|
-
constructor: function(m, f, config) {
|
228
|
-
//set up defaults
|
229
|
-
config = config || {};
|
230
|
-
Ext.applyIf(config, { disallowed: [] });
|
231
|
-
|
232
|
-
ExtMVC.model.plugin.validation.ValidatesExclusionOf.superclass.constructor.call(this, m, f, config);
|
233
|
-
|
234
|
-
Ext.applyIf(this, {
|
235
|
-
message: 'must not be ' + this.disallowed.toSentence('or')
|
236
|
-
});
|
237
|
-
},
|
238
|
-
|
239
|
-
/**
|
240
|
-
* Returns true if the value of this field is one of those specified in this.allowed
|
241
|
-
* @return {Boolean} True if the field's value is allowed
|
242
|
-
*/
|
243
|
-
isValid: function(instance) {
|
244
|
-
var value = this.getValue(instance),
|
245
|
-
valid = true;
|
246
|
-
|
247
|
-
for (var i=0; i < this.disallowed.length; i++) {
|
248
|
-
if (this.disallowed[i] == value) valid = false;
|
249
|
-
};
|
250
|
-
|
251
|
-
return valid;
|
252
|
-
}
|
253
|
-
});
|
254
|
-
|
255
|
-
/**
|
256
|
-
* @class ExtMVC.model.plugin.validation.ValidatesFormatOf
|
257
|
-
* @extends ExtMVC.model.plugin.validation.AbstractValidation
|
258
|
-
* Ensures that the field matches the given regular expression. See {*link ExtMVC.model.plugin.validation.AbstractValidation AbstractValidation} for example.
|
259
|
-
*/
|
260
|
-
ExtMVC.model.plugin.validation.ValidatesFormatOf = Ext.extend(ExtMVC.model.plugin.validation.AbstractValidation, {
|
261
|
-
|
262
|
-
/**
|
263
|
-
* @property message
|
264
|
-
* @type String
|
265
|
-
* The default message to return if this validation does not pass
|
266
|
-
*/
|
267
|
-
message: 'is invalid',
|
268
|
-
|
269
|
-
/**
|
270
|
-
* Returns true if the value of this field matches the suppled regular expression
|
271
|
-
* @return {Boolean} True if the field's value matches
|
272
|
-
*/
|
273
|
-
isValid: function(instance) {
|
274
|
-
return this.regex.test(this.getValue(instance));
|
275
|
-
}
|
276
|
-
});
|
Binary file
|
@@ -1,21 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Override how getXTypes works so that it doesn't require that every single class has
|
3
|
-
* an xtype registered for it.
|
4
|
-
*/
|
5
|
-
Ext.override(Ext.Component, {
|
6
|
-
getXTypes : function(){
|
7
|
-
var tc = this.constructor;
|
8
|
-
if(!tc.xtypes){
|
9
|
-
var c = [], sc = this;
|
10
|
-
while(sc){ //was: while(sc && sc.constructor.xtype) {
|
11
|
-
var xtype = sc.constructor.xtype;
|
12
|
-
if (xtype != undefined) c.unshift(xtype);
|
13
|
-
|
14
|
-
sc = sc.constructor.superclass;
|
15
|
-
}
|
16
|
-
tc.xtypeChain = c;
|
17
|
-
tc.xtypes = c.join('/');
|
18
|
-
}
|
19
|
-
return tc.xtypes;
|
20
|
-
}
|
21
|
-
});
|
@@ -1,142 +0,0 @@
|
|
1
|
-
// /**
|
2
|
-
// * An extension to Ext.extend which calls the extended object's onExtended function, if it exists
|
3
|
-
// * The only lines that are different from vanilla Ext.extend are the 2 before the return sb statement
|
4
|
-
// */
|
5
|
-
// Ext.extend = function(){
|
6
|
-
// // inline overrides
|
7
|
-
// var io = function(o){
|
8
|
-
// for(var m in o){
|
9
|
-
// this[m] = o[m];
|
10
|
-
// }
|
11
|
-
// };
|
12
|
-
// var oc = Object.prototype.constructor;
|
13
|
-
//
|
14
|
-
// return function(sb, sp, overrides){
|
15
|
-
// if(Ext.isObject(sp)){
|
16
|
-
// overrides = sp;
|
17
|
-
// sp = sb;
|
18
|
-
// sb = overrides.constructor!= oc ? overrides.constructor : function(){sp.apply(this, arguments);};
|
19
|
-
// }
|
20
|
-
// var F = function(){},
|
21
|
-
// sbp,
|
22
|
-
// spp = sp.prototype;
|
23
|
-
//
|
24
|
-
// F.prototype = spp;
|
25
|
-
// sbp = sb.prototype = new F();
|
26
|
-
// sbp.constructor=sb;
|
27
|
-
// sb.superclass=spp;
|
28
|
-
// if(spp.constructor == oc){
|
29
|
-
// spp.constructor=sp;
|
30
|
-
// }
|
31
|
-
// sb.override = function(o){
|
32
|
-
// Ext.override(sb, o);
|
33
|
-
// };
|
34
|
-
// sbp.superclass = sbp.supr = (function(){
|
35
|
-
// return spp;
|
36
|
-
// });
|
37
|
-
// sbp.override = io;
|
38
|
-
// Ext.override(sb, overrides);
|
39
|
-
// sb.extend = function(o){Ext.extend(sb, o);};
|
40
|
-
//
|
41
|
-
// var extendFunction = sb.prototype.onExtended;
|
42
|
-
// if (extendFunction) extendFunction.call(sb.prototype);
|
43
|
-
//
|
44
|
-
// return sb;
|
45
|
-
// };
|
46
|
-
// }();
|
47
|
-
|
48
|
-
// (function() {
|
49
|
-
// var inlineOverrides = function(o) {
|
50
|
-
// for(var m in o){
|
51
|
-
// this[m] = o[m];
|
52
|
-
// }
|
53
|
-
// };
|
54
|
-
//
|
55
|
-
// //reference to the constructor of Object - we can match against this so as not to extend improperly
|
56
|
-
// var objectConstructor = Object.prototype.constructor;
|
57
|
-
//
|
58
|
-
// /**
|
59
|
-
// * Returns true if the given function is the bottom level Object object. We use this to test if we are
|
60
|
-
// * extending Object directly, or some subclass of Object.
|
61
|
-
// * @param {Object} superclass The superclass constructor function
|
62
|
-
// */
|
63
|
-
// var superclassIsObject = function(superclass) {
|
64
|
-
// return superclass.prototype.constructor == objectConstructor;
|
65
|
-
// };
|
66
|
-
//
|
67
|
-
// Ext.extend = function() {
|
68
|
-
// //this method has two different signatures - 2 or 3 arguments
|
69
|
-
// if (arguments.length == 3) {
|
70
|
-
// // 3 arguments - where we're given the subclass constructor function, the superclass and some overrides
|
71
|
-
// var subclassConstructor = arguments[0],
|
72
|
-
// superclass = arguments[1],
|
73
|
-
// overrides = arguments[2];
|
74
|
-
// } else {
|
75
|
-
// // 2 arguments - where we're just given the superclass and some overrides
|
76
|
-
// var superclass = arguments[0],
|
77
|
-
// overrides = arguments[1];
|
78
|
-
//
|
79
|
-
// // Because we weren't given a subclass constructor, make one now
|
80
|
-
// var subclassConstructor = overrides.constructor == objectConstructor
|
81
|
-
// ? function(){superclass.apply(this, arguments);} //TODO: Explain this
|
82
|
-
// : overrides.constructor;
|
83
|
-
// }
|
84
|
-
//
|
85
|
-
// //This is the beginnings of our new class - just an empty function for now
|
86
|
-
// var F = function() {};
|
87
|
-
//
|
88
|
-
// //set our new class' prototype to the same as the superclass
|
89
|
-
// F.prototype = superclass.prototype;
|
90
|
-
//
|
91
|
-
// // This is where the actual 'inheritance' happens. In JavaScript we extend objects by setting the prototype
|
92
|
-
// // of a new object to an instance of an existing one
|
93
|
-
// subclassConstructor.prototype = new F();
|
94
|
-
//
|
95
|
-
// // We'll use the subclass and superclass prototypes a lot, so get references to them here
|
96
|
-
// var subclassProto = subclassConstructor.prototype,
|
97
|
-
// superclassProto = superclass.prototype;
|
98
|
-
//
|
99
|
-
// //Tell our new subclass its constructor
|
100
|
-
// subclassProto.constructor = subclassConstructor;
|
101
|
-
//
|
102
|
-
// //TODO: Here we're giving the subclass's constructor FUNCTION a supertype property, which is set to the prototype
|
103
|
-
// //of the supertype... why?
|
104
|
-
// subclassConstructor.superclass = superclass.prototype;
|
105
|
-
//
|
106
|
-
// // TODO: Explain this
|
107
|
-
// if (superclassIsObject(superclass)) superclassProto.constructor = superclass;
|
108
|
-
//
|
109
|
-
// //This is what enables your to do things like MyExtendedClass.superclass.initComponent.apply(this, arguments);
|
110
|
-
// subclassProto.superclass = subclassProto.supr = function() {
|
111
|
-
// return superclassProto;
|
112
|
-
// };
|
113
|
-
//
|
114
|
-
// subclassProto.override = inlineOverrides;
|
115
|
-
// Ext.override(subclassConstructor, overrides);
|
116
|
-
//
|
117
|
-
// //Here we're adding override and extend to the constructor Function itself... for some reason (e.g. Ext.Window.override({}))
|
118
|
-
// Ext.apply(subclassConstructor, {
|
119
|
-
// extend: function(o){
|
120
|
-
// Ext.extend(subclassConstructor, o);
|
121
|
-
// },
|
122
|
-
// override: function(o) {
|
123
|
-
// Ext.override(subclassConstructor, o);
|
124
|
-
// }
|
125
|
-
// });
|
126
|
-
//
|
127
|
-
// return subclassConstructor;
|
128
|
-
// };
|
129
|
-
// })();
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
data/lib/src/spec/Array.spec.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("Array extensions", function() {
|
3
|
-
describe("toSentence", function() {
|
4
|
-
var array = ['Adama', 'Tigh', 'Roslin'];
|
5
|
-
|
6
|
-
it("should join an array using and by default", function() {
|
7
|
-
expect(array.toSentence()).to(equal, "Adama, Tigh and Roslin");
|
8
|
-
});
|
9
|
-
|
10
|
-
it("should allow specification of a custom connector string", function() {
|
11
|
-
expect(array.toSentence('or')).to(equal, "Adama, Tigh or Roslin");
|
12
|
-
});
|
13
|
-
});
|
14
|
-
});
|
15
|
-
});
|