ende 0.4.5 → 0.4.6

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/javascripts/aura/extensions/devise.js.coffee +0 -2
  3. data/lib/assets/javascripts/aura/extensions/platform.js.coffee +3 -0
  4. data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +17 -1
  5. data/lib/assets/javascripts/aura/extensions/routes.js.coffee +8 -7
  6. data/lib/assets/javascripts/aura/extensions/states.js.coffee +13 -1
  7. data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +4 -2
  8. data/lib/assets/javascripts/config/load_components.js.coffee +19 -12
  9. data/lib/assets/javascripts/ende.js.coffee +33 -12
  10. data/lib/ende/version.rb +1 -1
  11. data/vendor/assets/components/build.css +111 -0
  12. data/vendor/assets/components/ende_build.js +160 -41
  13. data/vendor/components/indefinido-indemma/build/development.js +3 -118
  14. data/vendor/components/indefinido-indemma/build/release.js +39 -4170
  15. data/vendor/components/indefinido-indemma/build/test.js +3 -118
  16. data/vendor/components/indefinido-indemma/lib/record/associable.js +10 -2
  17. data/vendor/components/indefinido-indemma/lib/record/restfulable.js +26 -15
  18. data/vendor/components/indefinido-indemma/lib/record.js +3 -1
  19. data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +15 -1
  20. data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +37 -12
  21. data/vendor/components/indefinido-indemma/src/lib/record.coffee +3 -1
  22. data/vendor/components/indefinido-observable/.gitignore +15 -0
  23. data/vendor/components/indefinido-observable/.ruby-gemset +1 -0
  24. data/vendor/components/indefinido-observable/.ruby-version +1 -0
  25. data/vendor/components/indefinido-observable/Gemfile +13 -0
  26. data/vendor/components/indefinido-observable/Guardfile +39 -0
  27. data/vendor/components/indefinido-observable/History.md +0 -0
  28. data/vendor/components/indefinido-observable/Readme.md +116 -0
  29. data/vendor/components/indefinido-observable/build/build.js +14798 -0
  30. data/vendor/components/indefinido-observable/build/development.js +339 -0
  31. data/vendor/components/indefinido-observable/build/release.js +14937 -0
  32. data/vendor/components/indefinido-observable/build/test.js +339 -0
  33. data/vendor/components/indefinido-observable/component.json +5 -1
  34. data/vendor/components/indefinido-observable/components/chaijs-chai/component.json +46 -0
  35. data/vendor/components/indefinido-observable/components/chaijs-chai/index.js +1 -0
  36. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/assertion.js +132 -0
  37. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
  38. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/error.js +60 -0
  39. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/assert.js +1060 -0
  40. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
  41. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/should.js +76 -0
  42. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
  43. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
  44. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
  45. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/eql.js +124 -0
  46. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
  47. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
  48. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
  49. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
  50. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
  51. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
  52. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
  53. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/index.js +108 -0
  54. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/inspect.js +316 -0
  55. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
  56. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
  57. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
  58. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/test.js +26 -0
  59. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
  60. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/type.js +45 -0
  61. data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai.js +79 -0
  62. data/vendor/components/indefinido-observable/components/component-jquery/component.json +14 -0
  63. data/vendor/components/indefinido-observable/components/component-jquery/index.js +9601 -0
  64. data/vendor/components/indefinido-observable/components/kapit-observe-shim/component.json +11 -0
  65. data/vendor/components/indefinido-observable/components/kapit-observe-utils/component.json +13 -0
  66. data/vendor/components/indefinido-observable/karma.conf.js +92 -0
  67. data/vendor/components/indefinido-observable/lib/adapters/rivets.js +3 -1
  68. data/vendor/components/indefinido-observable/lib/observable.js +47 -13
  69. data/vendor/components/indefinido-observable/spec/legacy/observable_spec.js +126 -0
  70. data/vendor/components/indefinido-observable/spec/observable_spec.js +92 -0
  71. data/vendor/components/indefinido-observable/spec/spec_helper.js +8 -0
  72. data/vendor/components/indefinido-observable/spec/vendor/accessors_spec.js +63 -0
  73. data/vendor/components/indefinido-observable/src/lib/adapters/rivets.js.coffee +15 -0
  74. data/vendor/components/indefinido-observable/src/spec/legacy/observable_spec.coffee +132 -0
  75. data/vendor/components/indefinido-observable/src/spec/observable_spec.coffee +85 -0
  76. data/vendor/components/indefinido-observable/src/spec/spec_helper.coffee +5 -0
  77. data/vendor/components/indefinido-observable/src/spec/vendor/accessors_spec.coffee +59 -0
  78. data/vendor/components/indefinido-observable/vendor/shims/accessors.js +71 -9
  79. data/vendor/components/indefinido-observable/vendor/spec/boot.js +104 -0
  80. data/vendor/components/indefinido-observable/vendor/spec/jasmine.js +2054 -0
  81. metadata +58 -2
@@ -0,0 +1,1060 @@
1
+ /*!
2
+ * chai
3
+ * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+
8
+ module.exports = function (chai, util) {
9
+
10
+ /*!
11
+ * Chai dependencies.
12
+ */
13
+
14
+ var Assertion = chai.Assertion
15
+ , flag = util.flag;
16
+
17
+ /*!
18
+ * Module export.
19
+ */
20
+
21
+ /**
22
+ * ### assert(expression, message)
23
+ *
24
+ * Write your own test expressions.
25
+ *
26
+ * assert('foo' !== 'bar', 'foo is not bar');
27
+ * assert(Array.isArray([]), 'empty arrays are arrays');
28
+ *
29
+ * @param {Mixed} expression to test for truthiness
30
+ * @param {String} message to display on error
31
+ * @name assert
32
+ * @api public
33
+ */
34
+
35
+ var assert = chai.assert = function (express, errmsg) {
36
+ var test = new Assertion(null);
37
+ test.assert(
38
+ express
39
+ , errmsg
40
+ , '[ negation message unavailable ]'
41
+ );
42
+ };
43
+
44
+ /**
45
+ * ### .fail(actual, expected, [message], [operator])
46
+ *
47
+ * Throw a failure. Node.js `assert` module-compatible.
48
+ *
49
+ * @name fail
50
+ * @param {Mixed} actual
51
+ * @param {Mixed} expected
52
+ * @param {String} message
53
+ * @param {String} operator
54
+ * @api public
55
+ */
56
+
57
+ assert.fail = function (actual, expected, message, operator) {
58
+ throw new chai.AssertionError({
59
+ actual: actual
60
+ , expected: expected
61
+ , message: message
62
+ , operator: operator
63
+ , stackStartFunction: assert.fail
64
+ });
65
+ };
66
+
67
+ /**
68
+ * ### .ok(object, [message])
69
+ *
70
+ * Asserts that `object` is truthy.
71
+ *
72
+ * assert.ok('everything', 'everything is ok');
73
+ * assert.ok(false, 'this will fail');
74
+ *
75
+ * @name ok
76
+ * @param {Mixed} object to test
77
+ * @param {String} message
78
+ * @api public
79
+ */
80
+
81
+ assert.ok = function (val, msg) {
82
+ new Assertion(val, msg).is.ok;
83
+ };
84
+
85
+ /**
86
+ * ### .equal(actual, expected, [message])
87
+ *
88
+ * Asserts non-strict equality (`==`) of `actual` and `expected`.
89
+ *
90
+ * assert.equal(3, '3', '== coerces values to strings');
91
+ *
92
+ * @name equal
93
+ * @param {Mixed} actual
94
+ * @param {Mixed} expected
95
+ * @param {String} message
96
+ * @api public
97
+ */
98
+
99
+ assert.equal = function (act, exp, msg) {
100
+ var test = new Assertion(act, msg);
101
+
102
+ test.assert(
103
+ exp == flag(test, 'object')
104
+ , 'expected #{this} to equal #{exp}'
105
+ , 'expected #{this} to not equal #{act}'
106
+ , exp
107
+ , act
108
+ );
109
+ };
110
+
111
+ /**
112
+ * ### .notEqual(actual, expected, [message])
113
+ *
114
+ * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
115
+ *
116
+ * assert.notEqual(3, 4, 'these numbers are not equal');
117
+ *
118
+ * @name notEqual
119
+ * @param {Mixed} actual
120
+ * @param {Mixed} expected
121
+ * @param {String} message
122
+ * @api public
123
+ */
124
+
125
+ assert.notEqual = function (act, exp, msg) {
126
+ var test = new Assertion(act, msg);
127
+
128
+ test.assert(
129
+ exp != flag(test, 'object')
130
+ , 'expected #{this} to not equal #{exp}'
131
+ , 'expected #{this} to equal #{act}'
132
+ , exp
133
+ , act
134
+ );
135
+ };
136
+
137
+ /**
138
+ * ### .strictEqual(actual, expected, [message])
139
+ *
140
+ * Asserts strict equality (`===`) of `actual` and `expected`.
141
+ *
142
+ * assert.strictEqual(true, true, 'these booleans are strictly equal');
143
+ *
144
+ * @name strictEqual
145
+ * @param {Mixed} actual
146
+ * @param {Mixed} expected
147
+ * @param {String} message
148
+ * @api public
149
+ */
150
+
151
+ assert.strictEqual = function (act, exp, msg) {
152
+ new Assertion(act, msg).to.equal(exp);
153
+ };
154
+
155
+ /**
156
+ * ### .notStrictEqual(actual, expected, [message])
157
+ *
158
+ * Asserts strict inequality (`!==`) of `actual` and `expected`.
159
+ *
160
+ * assert.notStrictEqual(3, '3', 'no coercion for strict equality');
161
+ *
162
+ * @name notStrictEqual
163
+ * @param {Mixed} actual
164
+ * @param {Mixed} expected
165
+ * @param {String} message
166
+ * @api public
167
+ */
168
+
169
+ assert.notStrictEqual = function (act, exp, msg) {
170
+ new Assertion(act, msg).to.not.equal(exp);
171
+ };
172
+
173
+ /**
174
+ * ### .deepEqual(actual, expected, [message])
175
+ *
176
+ * Asserts that `actual` is deeply equal to `expected`.
177
+ *
178
+ * assert.deepEqual({ tea: 'green' }, { tea: 'green' });
179
+ *
180
+ * @name deepEqual
181
+ * @param {Mixed} actual
182
+ * @param {Mixed} expected
183
+ * @param {String} message
184
+ * @api public
185
+ */
186
+
187
+ assert.deepEqual = function (act, exp, msg) {
188
+ new Assertion(act, msg).to.eql(exp);
189
+ };
190
+
191
+ /**
192
+ * ### .notDeepEqual(actual, expected, [message])
193
+ *
194
+ * Assert that `actual` is not deeply equal to `expected`.
195
+ *
196
+ * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
197
+ *
198
+ * @name notDeepEqual
199
+ * @param {Mixed} actual
200
+ * @param {Mixed} expected
201
+ * @param {String} message
202
+ * @api public
203
+ */
204
+
205
+ assert.notDeepEqual = function (act, exp, msg) {
206
+ new Assertion(act, msg).to.not.eql(exp);
207
+ };
208
+
209
+ /**
210
+ * ### .isTrue(value, [message])
211
+ *
212
+ * Asserts that `value` is true.
213
+ *
214
+ * var teaServed = true;
215
+ * assert.isTrue(teaServed, 'the tea has been served');
216
+ *
217
+ * @name isTrue
218
+ * @param {Mixed} value
219
+ * @param {String} message
220
+ * @api public
221
+ */
222
+
223
+ assert.isTrue = function (val, msg) {
224
+ new Assertion(val, msg).is['true'];
225
+ };
226
+
227
+ /**
228
+ * ### .isFalse(value, [message])
229
+ *
230
+ * Asserts that `value` is false.
231
+ *
232
+ * var teaServed = false;
233
+ * assert.isFalse(teaServed, 'no tea yet? hmm...');
234
+ *
235
+ * @name isFalse
236
+ * @param {Mixed} value
237
+ * @param {String} message
238
+ * @api public
239
+ */
240
+
241
+ assert.isFalse = function (val, msg) {
242
+ new Assertion(val, msg).is['false'];
243
+ };
244
+
245
+ /**
246
+ * ### .isNull(value, [message])
247
+ *
248
+ * Asserts that `value` is null.
249
+ *
250
+ * assert.isNull(err, 'there was no error');
251
+ *
252
+ * @name isNull
253
+ * @param {Mixed} value
254
+ * @param {String} message
255
+ * @api public
256
+ */
257
+
258
+ assert.isNull = function (val, msg) {
259
+ new Assertion(val, msg).to.equal(null);
260
+ };
261
+
262
+ /**
263
+ * ### .isNotNull(value, [message])
264
+ *
265
+ * Asserts that `value` is not null.
266
+ *
267
+ * var tea = 'tasty chai';
268
+ * assert.isNotNull(tea, 'great, time for tea!');
269
+ *
270
+ * @name isNotNull
271
+ * @param {Mixed} value
272
+ * @param {String} message
273
+ * @api public
274
+ */
275
+
276
+ assert.isNotNull = function (val, msg) {
277
+ new Assertion(val, msg).to.not.equal(null);
278
+ };
279
+
280
+ /**
281
+ * ### .isUndefined(value, [message])
282
+ *
283
+ * Asserts that `value` is `undefined`.
284
+ *
285
+ * var tea;
286
+ * assert.isUndefined(tea, 'no tea defined');
287
+ *
288
+ * @name isUndefined
289
+ * @param {Mixed} value
290
+ * @param {String} message
291
+ * @api public
292
+ */
293
+
294
+ assert.isUndefined = function (val, msg) {
295
+ new Assertion(val, msg).to.equal(undefined);
296
+ };
297
+
298
+ /**
299
+ * ### .isDefined(value, [message])
300
+ *
301
+ * Asserts that `value` is not `undefined`.
302
+ *
303
+ * var tea = 'cup of chai';
304
+ * assert.isDefined(tea, 'tea has been defined');
305
+ *
306
+ * @name isDefined
307
+ * @param {Mixed} value
308
+ * @param {String} message
309
+ * @api public
310
+ */
311
+
312
+ assert.isDefined = function (val, msg) {
313
+ new Assertion(val, msg).to.not.equal(undefined);
314
+ };
315
+
316
+ /**
317
+ * ### .isFunction(value, [message])
318
+ *
319
+ * Asserts that `value` is a function.
320
+ *
321
+ * function serveTea() { return 'cup of tea'; };
322
+ * assert.isFunction(serveTea, 'great, we can have tea now');
323
+ *
324
+ * @name isFunction
325
+ * @param {Mixed} value
326
+ * @param {String} message
327
+ * @api public
328
+ */
329
+
330
+ assert.isFunction = function (val, msg) {
331
+ new Assertion(val, msg).to.be.a('function');
332
+ };
333
+
334
+ /**
335
+ * ### .isNotFunction(value, [message])
336
+ *
337
+ * Asserts that `value` is _not_ a function.
338
+ *
339
+ * var serveTea = [ 'heat', 'pour', 'sip' ];
340
+ * assert.isNotFunction(serveTea, 'great, we have listed the steps');
341
+ *
342
+ * @name isNotFunction
343
+ * @param {Mixed} value
344
+ * @param {String} message
345
+ * @api public
346
+ */
347
+
348
+ assert.isNotFunction = function (val, msg) {
349
+ new Assertion(val, msg).to.not.be.a('function');
350
+ };
351
+
352
+ /**
353
+ * ### .isObject(value, [message])
354
+ *
355
+ * Asserts that `value` is an object (as revealed by
356
+ * `Object.prototype.toString`).
357
+ *
358
+ * var selection = { name: 'Chai', serve: 'with spices' };
359
+ * assert.isObject(selection, 'tea selection is an object');
360
+ *
361
+ * @name isObject
362
+ * @param {Mixed} value
363
+ * @param {String} message
364
+ * @api public
365
+ */
366
+
367
+ assert.isObject = function (val, msg) {
368
+ new Assertion(val, msg).to.be.a('object');
369
+ };
370
+
371
+ /**
372
+ * ### .isNotObject(value, [message])
373
+ *
374
+ * Asserts that `value` is _not_ an object.
375
+ *
376
+ * var selection = 'chai'
377
+ * assert.isObject(selection, 'tea selection is not an object');
378
+ * assert.isObject(null, 'null is not an object');
379
+ *
380
+ * @name isNotObject
381
+ * @param {Mixed} value
382
+ * @param {String} message
383
+ * @api public
384
+ */
385
+
386
+ assert.isNotObject = function (val, msg) {
387
+ new Assertion(val, msg).to.not.be.a('object');
388
+ };
389
+
390
+ /**
391
+ * ### .isArray(value, [message])
392
+ *
393
+ * Asserts that `value` is an array.
394
+ *
395
+ * var menu = [ 'green', 'chai', 'oolong' ];
396
+ * assert.isArray(menu, 'what kind of tea do we want?');
397
+ *
398
+ * @name isArray
399
+ * @param {Mixed} value
400
+ * @param {String} message
401
+ * @api public
402
+ */
403
+
404
+ assert.isArray = function (val, msg) {
405
+ new Assertion(val, msg).to.be.an('array');
406
+ };
407
+
408
+ /**
409
+ * ### .isNotArray(value, [message])
410
+ *
411
+ * Asserts that `value` is _not_ an array.
412
+ *
413
+ * var menu = 'green|chai|oolong';
414
+ * assert.isNotArray(menu, 'what kind of tea do we want?');
415
+ *
416
+ * @name isNotArray
417
+ * @param {Mixed} value
418
+ * @param {String} message
419
+ * @api public
420
+ */
421
+
422
+ assert.isNotArray = function (val, msg) {
423
+ new Assertion(val, msg).to.not.be.an('array');
424
+ };
425
+
426
+ /**
427
+ * ### .isString(value, [message])
428
+ *
429
+ * Asserts that `value` is a string.
430
+ *
431
+ * var teaOrder = 'chai';
432
+ * assert.isString(teaOrder, 'order placed');
433
+ *
434
+ * @name isString
435
+ * @param {Mixed} value
436
+ * @param {String} message
437
+ * @api public
438
+ */
439
+
440
+ assert.isString = function (val, msg) {
441
+ new Assertion(val, msg).to.be.a('string');
442
+ };
443
+
444
+ /**
445
+ * ### .isNotString(value, [message])
446
+ *
447
+ * Asserts that `value` is _not_ a string.
448
+ *
449
+ * var teaOrder = 4;
450
+ * assert.isNotString(teaOrder, 'order placed');
451
+ *
452
+ * @name isNotString
453
+ * @param {Mixed} value
454
+ * @param {String} message
455
+ * @api public
456
+ */
457
+
458
+ assert.isNotString = function (val, msg) {
459
+ new Assertion(val, msg).to.not.be.a('string');
460
+ };
461
+
462
+ /**
463
+ * ### .isNumber(value, [message])
464
+ *
465
+ * Asserts that `value` is a number.
466
+ *
467
+ * var cups = 2;
468
+ * assert.isNumber(cups, 'how many cups');
469
+ *
470
+ * @name isNumber
471
+ * @param {Number} value
472
+ * @param {String} message
473
+ * @api public
474
+ */
475
+
476
+ assert.isNumber = function (val, msg) {
477
+ new Assertion(val, msg).to.be.a('number');
478
+ };
479
+
480
+ /**
481
+ * ### .isNotNumber(value, [message])
482
+ *
483
+ * Asserts that `value` is _not_ a number.
484
+ *
485
+ * var cups = '2 cups please';
486
+ * assert.isNotNumber(cups, 'how many cups');
487
+ *
488
+ * @name isNotNumber
489
+ * @param {Mixed} value
490
+ * @param {String} message
491
+ * @api public
492
+ */
493
+
494
+ assert.isNotNumber = function (val, msg) {
495
+ new Assertion(val, msg).to.not.be.a('number');
496
+ };
497
+
498
+ /**
499
+ * ### .isBoolean(value, [message])
500
+ *
501
+ * Asserts that `value` is a boolean.
502
+ *
503
+ * var teaReady = true
504
+ * , teaServed = false;
505
+ *
506
+ * assert.isBoolean(teaReady, 'is the tea ready');
507
+ * assert.isBoolean(teaServed, 'has tea been served');
508
+ *
509
+ * @name isBoolean
510
+ * @param {Mixed} value
511
+ * @param {String} message
512
+ * @api public
513
+ */
514
+
515
+ assert.isBoolean = function (val, msg) {
516
+ new Assertion(val, msg).to.be.a('boolean');
517
+ };
518
+
519
+ /**
520
+ * ### .isNotBoolean(value, [message])
521
+ *
522
+ * Asserts that `value` is _not_ a boolean.
523
+ *
524
+ * var teaReady = 'yep'
525
+ * , teaServed = 'nope';
526
+ *
527
+ * assert.isNotBoolean(teaReady, 'is the tea ready');
528
+ * assert.isNotBoolean(teaServed, 'has tea been served');
529
+ *
530
+ * @name isNotBoolean
531
+ * @param {Mixed} value
532
+ * @param {String} message
533
+ * @api public
534
+ */
535
+
536
+ assert.isNotBoolean = function (val, msg) {
537
+ new Assertion(val, msg).to.not.be.a('boolean');
538
+ };
539
+
540
+ /**
541
+ * ### .typeOf(value, name, [message])
542
+ *
543
+ * Asserts that `value`'s type is `name`, as determined by
544
+ * `Object.prototype.toString`.
545
+ *
546
+ * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');
547
+ * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');
548
+ * assert.typeOf('tea', 'string', 'we have a string');
549
+ * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');
550
+ * assert.typeOf(null, 'null', 'we have a null');
551
+ * assert.typeOf(undefined, 'undefined', 'we have an undefined');
552
+ *
553
+ * @name typeOf
554
+ * @param {Mixed} value
555
+ * @param {String} name
556
+ * @param {String} message
557
+ * @api public
558
+ */
559
+
560
+ assert.typeOf = function (val, type, msg) {
561
+ new Assertion(val, msg).to.be.a(type);
562
+ };
563
+
564
+ /**
565
+ * ### .notTypeOf(value, name, [message])
566
+ *
567
+ * Asserts that `value`'s type is _not_ `name`, as determined by
568
+ * `Object.prototype.toString`.
569
+ *
570
+ * assert.notTypeOf('tea', 'number', 'strings are not numbers');
571
+ *
572
+ * @name notTypeOf
573
+ * @param {Mixed} value
574
+ * @param {String} typeof name
575
+ * @param {String} message
576
+ * @api public
577
+ */
578
+
579
+ assert.notTypeOf = function (val, type, msg) {
580
+ new Assertion(val, msg).to.not.be.a(type);
581
+ };
582
+
583
+ /**
584
+ * ### .instanceOf(object, constructor, [message])
585
+ *
586
+ * Asserts that `value` is an instance of `constructor`.
587
+ *
588
+ * var Tea = function (name) { this.name = name; }
589
+ * , chai = new Tea('chai');
590
+ *
591
+ * assert.instanceOf(chai, Tea, 'chai is an instance of tea');
592
+ *
593
+ * @name instanceOf
594
+ * @param {Object} object
595
+ * @param {Constructor} constructor
596
+ * @param {String} message
597
+ * @api public
598
+ */
599
+
600
+ assert.instanceOf = function (val, type, msg) {
601
+ new Assertion(val, msg).to.be.instanceOf(type);
602
+ };
603
+
604
+ /**
605
+ * ### .notInstanceOf(object, constructor, [message])
606
+ *
607
+ * Asserts `value` is not an instance of `constructor`.
608
+ *
609
+ * var Tea = function (name) { this.name = name; }
610
+ * , chai = new String('chai');
611
+ *
612
+ * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
613
+ *
614
+ * @name notInstanceOf
615
+ * @param {Object} object
616
+ * @param {Constructor} constructor
617
+ * @param {String} message
618
+ * @api public
619
+ */
620
+
621
+ assert.notInstanceOf = function (val, type, msg) {
622
+ new Assertion(val, msg).to.not.be.instanceOf(type);
623
+ };
624
+
625
+ /**
626
+ * ### .include(haystack, needle, [message])
627
+ *
628
+ * Asserts that `haystack` includes `needle`. Works
629
+ * for strings and arrays.
630
+ *
631
+ * assert.include('foobar', 'bar', 'foobar contains string "bar"');
632
+ * assert.include([ 1, 2, 3 ], 3, 'array contains value');
633
+ *
634
+ * @name include
635
+ * @param {Array|String} haystack
636
+ * @param {Mixed} needle
637
+ * @param {String} message
638
+ * @api public
639
+ */
640
+
641
+ assert.include = function (exp, inc, msg) {
642
+ var obj = new Assertion(exp, msg);
643
+
644
+ if (Array.isArray(exp)) {
645
+ obj.to.include(inc);
646
+ } else if ('string' === typeof exp) {
647
+ obj.to.contain.string(inc);
648
+ } else {
649
+ throw new chai.AssertionError({
650
+ message: 'expected an array or string'
651
+ , stackStartFunction: assert.include
652
+ });
653
+ }
654
+ };
655
+
656
+ /**
657
+ * ### .notInclude(haystack, needle, [message])
658
+ *
659
+ * Asserts that `haystack` does not include `needle`. Works
660
+ * for strings and arrays.
661
+ *i
662
+ * assert.notInclude('foobar', 'baz', 'string not include substring');
663
+ * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');
664
+ *
665
+ * @name notInclude
666
+ * @param {Array|String} haystack
667
+ * @param {Mixed} needle
668
+ * @param {String} message
669
+ * @api public
670
+ */
671
+
672
+ assert.notInclude = function (exp, inc, msg) {
673
+ var obj = new Assertion(exp, msg);
674
+
675
+ if (Array.isArray(exp)) {
676
+ obj.to.not.include(inc);
677
+ } else if ('string' === typeof exp) {
678
+ obj.to.not.contain.string(inc);
679
+ } else {
680
+ throw new chai.AssertionError({
681
+ message: 'expected an array or string'
682
+ , stackStartFunction: assert.include
683
+ });
684
+ }
685
+ };
686
+
687
+ /**
688
+ * ### .match(value, regexp, [message])
689
+ *
690
+ * Asserts that `value` matches the regular expression `regexp`.
691
+ *
692
+ * assert.match('foobar', /^foo/, 'regexp matches');
693
+ *
694
+ * @name match
695
+ * @param {Mixed} value
696
+ * @param {RegExp} regexp
697
+ * @param {String} message
698
+ * @api public
699
+ */
700
+
701
+ assert.match = function (exp, re, msg) {
702
+ new Assertion(exp, msg).to.match(re);
703
+ };
704
+
705
+ /**
706
+ * ### .notMatch(value, regexp, [message])
707
+ *
708
+ * Asserts that `value` does not match the regular expression `regexp`.
709
+ *
710
+ * assert.notMatch('foobar', /^foo/, 'regexp does not match');
711
+ *
712
+ * @name notMatch
713
+ * @param {Mixed} value
714
+ * @param {RegExp} regexp
715
+ * @param {String} message
716
+ * @api public
717
+ */
718
+
719
+ assert.notMatch = function (exp, re, msg) {
720
+ new Assertion(exp, msg).to.not.match(re);
721
+ };
722
+
723
+ /**
724
+ * ### .property(object, property, [message])
725
+ *
726
+ * Asserts that `object` has a property named by `property`.
727
+ *
728
+ * assert.property({ tea: { green: 'matcha' }}, 'tea');
729
+ *
730
+ * @name property
731
+ * @param {Object} object
732
+ * @param {String} property
733
+ * @param {String} message
734
+ * @api public
735
+ */
736
+
737
+ assert.property = function (obj, prop, msg) {
738
+ new Assertion(obj, msg).to.have.property(prop);
739
+ };
740
+
741
+ /**
742
+ * ### .notProperty(object, property, [message])
743
+ *
744
+ * Asserts that `object` does _not_ have a property named by `property`.
745
+ *
746
+ * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
747
+ *
748
+ * @name notProperty
749
+ * @param {Object} object
750
+ * @param {String} property
751
+ * @param {String} message
752
+ * @api public
753
+ */
754
+
755
+ assert.notProperty = function (obj, prop, msg) {
756
+ new Assertion(obj, msg).to.not.have.property(prop);
757
+ };
758
+
759
+ /**
760
+ * ### .deepProperty(object, property, [message])
761
+ *
762
+ * Asserts that `object` has a property named by `property`, which can be a
763
+ * string using dot- and bracket-notation for deep reference.
764
+ *
765
+ * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green');
766
+ *
767
+ * @name deepProperty
768
+ * @param {Object} object
769
+ * @param {String} property
770
+ * @param {String} message
771
+ * @api public
772
+ */
773
+
774
+ assert.deepProperty = function (obj, prop, msg) {
775
+ new Assertion(obj, msg).to.have.deep.property(prop);
776
+ };
777
+
778
+ /**
779
+ * ### .notDeepProperty(object, property, [message])
780
+ *
781
+ * Asserts that `object` does _not_ have a property named by `property`, which
782
+ * can be a string using dot- and bracket-notation for deep reference.
783
+ *
784
+ * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
785
+ *
786
+ * @name notDeepProperty
787
+ * @param {Object} object
788
+ * @param {String} property
789
+ * @param {String} message
790
+ * @api public
791
+ */
792
+
793
+ assert.notDeepProperty = function (obj, prop, msg) {
794
+ new Assertion(obj, msg).to.not.have.deep.property(prop);
795
+ };
796
+
797
+ /**
798
+ * ### .propertyVal(object, property, value, [message])
799
+ *
800
+ * Asserts that `object` has a property named by `property` with value given
801
+ * by `value`.
802
+ *
803
+ * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
804
+ *
805
+ * @name propertyVal
806
+ * @param {Object} object
807
+ * @param {String} property
808
+ * @param {Mixed} value
809
+ * @param {String} message
810
+ * @api public
811
+ */
812
+
813
+ assert.propertyVal = function (obj, prop, val, msg) {
814
+ new Assertion(obj, msg).to.have.property(prop, val);
815
+ };
816
+
817
+ /**
818
+ * ### .propertyNotVal(object, property, value, [message])
819
+ *
820
+ * Asserts that `object` has a property named by `property`, but with a value
821
+ * different from that given by `value`.
822
+ *
823
+ * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad');
824
+ *
825
+ * @name propertyNotVal
826
+ * @param {Object} object
827
+ * @param {String} property
828
+ * @param {Mixed} value
829
+ * @param {String} message
830
+ * @api public
831
+ */
832
+
833
+ assert.propertyNotVal = function (obj, prop, val, msg) {
834
+ new Assertion(obj, msg).to.not.have.property(prop, val);
835
+ };
836
+
837
+ /**
838
+ * ### .deepPropertyVal(object, property, value, [message])
839
+ *
840
+ * Asserts that `object` has a property named by `property` with value given
841
+ * by `value`. `property` can use dot- and bracket-notation for deep
842
+ * reference.
843
+ *
844
+ * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
845
+ *
846
+ * @name deepPropertyVal
847
+ * @param {Object} object
848
+ * @param {String} property
849
+ * @param {Mixed} value
850
+ * @param {String} message
851
+ * @api public
852
+ */
853
+
854
+ assert.deepPropertyVal = function (obj, prop, val, msg) {
855
+ new Assertion(obj, msg).to.have.deep.property(prop, val);
856
+ };
857
+
858
+ /**
859
+ * ### .deepPropertyNotVal(object, property, value, [message])
860
+ *
861
+ * Asserts that `object` has a property named by `property`, but with a value
862
+ * different from that given by `value`. `property` can use dot- and
863
+ * bracket-notation for deep reference.
864
+ *
865
+ * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');
866
+ *
867
+ * @name deepPropertyNotVal
868
+ * @param {Object} object
869
+ * @param {String} property
870
+ * @param {Mixed} value
871
+ * @param {String} message
872
+ * @api public
873
+ */
874
+
875
+ assert.deepPropertyNotVal = function (obj, prop, val, msg) {
876
+ new Assertion(obj, msg).to.not.have.deep.property(prop, val);
877
+ };
878
+
879
+ /**
880
+ * ### .lengthOf(object, length, [message])
881
+ *
882
+ * Asserts that `object` has a `length` property with the expected value.
883
+ *
884
+ * assert.lengthOf([1,2,3], 3, 'array has length of 3');
885
+ * assert.lengthOf('foobar', 5, 'string has length of 6');
886
+ *
887
+ * @name lengthOf
888
+ * @param {Mixed} object
889
+ * @param {Number} length
890
+ * @param {String} message
891
+ * @api public
892
+ */
893
+
894
+ assert.lengthOf = function (exp, len, msg) {
895
+ new Assertion(exp, msg).to.have.length(len);
896
+ };
897
+
898
+ /**
899
+ * ### .throws(function, [constructor/string/regexp], [string/regexp], [message])
900
+ *
901
+ * Asserts that `function` will throw an error that is an instance of
902
+ * `constructor`, or alternately that it will throw an error with message
903
+ * matching `regexp`.
904
+ *
905
+ * assert.throw(fn, 'function throws a reference error');
906
+ * assert.throw(fn, /function throws a reference error/);
907
+ * assert.throw(fn, ReferenceError);
908
+ * assert.throw(fn, ReferenceError, 'function throws a reference error');
909
+ * assert.throw(fn, ReferenceError, /function throws a reference error/);
910
+ *
911
+ * @name throws
912
+ * @alias throw
913
+ * @alias Throw
914
+ * @param {Function} function
915
+ * @param {ErrorConstructor} constructor
916
+ * @param {RegExp} regexp
917
+ * @param {String} message
918
+ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
919
+ * @api public
920
+ */
921
+
922
+ assert.Throw = function (fn, errt, errs, msg) {
923
+ if ('string' === typeof errt || errt instanceof RegExp) {
924
+ errs = errt;
925
+ errt = null;
926
+ }
927
+
928
+ new Assertion(fn, msg).to.Throw(errt, errs);
929
+ };
930
+
931
+ /**
932
+ * ### .doesNotThrow(function, [constructor/regexp], [message])
933
+ *
934
+ * Asserts that `function` will _not_ throw an error that is an instance of
935
+ * `constructor`, or alternately that it will not throw an error with message
936
+ * matching `regexp`.
937
+ *
938
+ * assert.doesNotThrow(fn, Error, 'function does not throw');
939
+ *
940
+ * @name doesNotThrow
941
+ * @param {Function} function
942
+ * @param {ErrorConstructor} constructor
943
+ * @param {RegExp} regexp
944
+ * @param {String} message
945
+ * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
946
+ * @api public
947
+ */
948
+
949
+ assert.doesNotThrow = function (fn, type, msg) {
950
+ if ('string' === typeof type) {
951
+ msg = type;
952
+ type = null;
953
+ }
954
+
955
+ new Assertion(fn, msg).to.not.Throw(type);
956
+ };
957
+
958
+ /**
959
+ * ### .operator(val1, operator, val2, [message])
960
+ *
961
+ * Compares two values using `operator`.
962
+ *
963
+ * assert.operator(1, '<', 2, 'everything is ok');
964
+ * assert.operator(1, '>', 2, 'this will fail');
965
+ *
966
+ * @name operator
967
+ * @param {Mixed} val1
968
+ * @param {String} operator
969
+ * @param {Mixed} val2
970
+ * @param {String} message
971
+ * @api public
972
+ */
973
+
974
+ assert.operator = function (val, operator, val2, msg) {
975
+ if (!~['==', '===', '>', '>=', '<', '<=', '!=', '!=='].indexOf(operator)) {
976
+ throw new Error('Invalid operator "' + operator + '"');
977
+ }
978
+ var test = new Assertion(eval(val + operator + val2), msg);
979
+ test.assert(
980
+ true === flag(test, 'object')
981
+ , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
982
+ , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
983
+ };
984
+
985
+ /**
986
+ * ### .closeTo(actual, expected, delta, [message])
987
+ *
988
+ * Asserts that the target is equal `expected`, to within a +/- `delta` range.
989
+ *
990
+ * assert.closeTo(1.5, 1, 0.5, 'numbers are close');
991
+ *
992
+ * @name closeTo
993
+ * @param {Number} actual
994
+ * @param {Number} expected
995
+ * @param {Number} delta
996
+ * @param {String} message
997
+ * @api public
998
+ */
999
+
1000
+ assert.closeTo = function (act, exp, delta, msg) {
1001
+ new Assertion(act, msg).to.be.closeTo(exp, delta);
1002
+ };
1003
+
1004
+ /**
1005
+ * ### .sameMembers(set1, set2, [message])
1006
+ *
1007
+ * Asserts that `set1` and `set2` have the same members.
1008
+ * Order is not taken into account.
1009
+ *
1010
+ * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
1011
+ *
1012
+ * @name sameMembers
1013
+ * @param {Array} superset
1014
+ * @param {Array} subset
1015
+ * @param {String} message
1016
+ * @api public
1017
+ */
1018
+
1019
+ assert.sameMembers = function (set1, set2, msg) {
1020
+ new Assertion(set1, msg).to.have.same.members(set2);
1021
+ }
1022
+
1023
+ /**
1024
+ * ### .includeMembers(superset, subset, [message])
1025
+ *
1026
+ * Asserts that `subset` is included in `superset`.
1027
+ * Order is not taken into account.
1028
+ *
1029
+ * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
1030
+ *
1031
+ * @name includeMembers
1032
+ * @param {Array} superset
1033
+ * @param {Array} subset
1034
+ * @param {String} message
1035
+ * @api public
1036
+ */
1037
+
1038
+ assert.includeMembers = function (superset, subset, msg) {
1039
+ new Assertion(superset, msg).to.include.members(subset);
1040
+ }
1041
+
1042
+ /*!
1043
+ * Undocumented / untested
1044
+ */
1045
+
1046
+ assert.ifError = function (val, msg) {
1047
+ new Assertion(val, msg).to.not.be.ok;
1048
+ };
1049
+
1050
+ /*!
1051
+ * Aliases.
1052
+ */
1053
+
1054
+ (function alias(name, as){
1055
+ assert[as] = assert[name];
1056
+ return alias;
1057
+ })
1058
+ ('Throw', 'throw')
1059
+ ('Throw', 'throws');
1060
+ };