ende 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +2 -2
- data/components/component/bind/{0.0.1 → 1.0.0}/component.json +1 -1
- data/components/component/bind/{0.0.1 → 1.0.0}/index.js +1 -2
- data/components/component/jquery/1.0.0/component.json +10 -0
- data/components/component/jquery/1.0.0/index.js +10308 -0
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/component.json +1 -1
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/index.js +0 -0
- data/components/indefinido/advisable/master/component.json +1 -1
- data/components/indefinido/indemma/master/component.json +4 -7
- data/components/indefinido/indemma/master/lib/record.js +7 -2
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +15 -6
- data/components/indefinido/indemma/master/lib/record/scopable.js +1 -1
- data/components/indefinido/observable/es6-modules/component.json +1 -1
- data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +8 -3
- data/components/indefinido/observable/es6-modules/lib/observable.js +0 -1
- data/components/indefinido/observable/es6-modules/lib/observable/observation.js +2 -2
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/component.json +1 -1
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/es6-shim.js +151 -102
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/component.json +2 -2
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/dist/assimilate.js +1 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +12 -6
- data/lib/assets/javascripts/config/load_components.js.coffee +1 -1
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/component/build.css +112 -0
- data/vendor/assets/components/ende_build.js +20357 -19584
- metadata +13 -84
- data/components/chaijs/assertion-error/1.0.0/component.json +0 -18
- data/components/chaijs/assertion-error/1.0.0/index.js +0 -110
- data/components/chaijs/chai/1.9.1/.gitignore +0 -22
- data/components/chaijs/chai/1.9.1/.mailmap +0 -1
- data/components/chaijs/chai/1.9.1/.npmignore +0 -14
- data/components/chaijs/chai/1.9.1/.travis.yml +0 -14
- data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +0 -173
- data/components/chaijs/chai/1.9.1/History.md +0 -895
- data/components/chaijs/chai/1.9.1/Makefile +0 -93
- data/components/chaijs/chai/1.9.1/README.md +0 -99
- data/components/chaijs/chai/1.9.1/ReleaseNotes.md +0 -482
- data/components/chaijs/chai/1.9.1/bower.json +0 -27
- data/components/chaijs/chai/1.9.1/chai.js +0 -4782
- data/components/chaijs/chai/1.9.1/component.json +0 -50
- data/components/chaijs/chai/1.9.1/index.js +0 -1
- data/components/chaijs/chai/1.9.1/karma.conf.js +0 -28
- data/components/chaijs/chai/1.9.1/karma.sauce.js +0 -41
- data/components/chaijs/chai/1.9.1/lib/chai.js +0 -87
- data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +0 -130
- data/components/chaijs/chai/1.9.1/lib/chai/config.js +0 -50
- data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +0 -1314
- data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +0 -1056
- data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +0 -12
- data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +0 -78
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +0 -111
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +0 -43
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +0 -40
- data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +0 -32
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +0 -18
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +0 -20
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +0 -102
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +0 -35
- data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +0 -114
- data/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +0 -320
- data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +0 -53
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +0 -51
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +0 -54
- data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +0 -26
- data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +0 -44
- data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +0 -45
- data/components/chaijs/chai/1.9.1/package.json +0 -42
- data/components/chaijs/chai/1.9.1/sauce.browsers.js +0 -128
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +0 -7
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +0 -53
- data/components/chaijs/chai/1.9.1/test/assert.js +0 -638
- data/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +0 -22
- data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +0 -22
- data/components/chaijs/chai/1.9.1/test/configuration.js +0 -133
- data/components/chaijs/chai/1.9.1/test/display/errors.js +0 -14
- data/components/chaijs/chai/1.9.1/test/display/message.js +0 -47
- data/components/chaijs/chai/1.9.1/test/expect.js +0 -814
- data/components/chaijs/chai/1.9.1/test/globalShould.js +0 -15
- data/components/chaijs/chai/1.9.1/test/plugins.js +0 -24
- data/components/chaijs/chai/1.9.1/test/should.js +0 -744
- data/components/chaijs/chai/1.9.1/test/utilities.js +0 -309
- data/components/chaijs/deep-eql/0.1.3/component.json +0 -20
- data/components/chaijs/deep-eql/0.1.3/lib/eql.js +0 -257
- data/components/chaijs/type-detect/0.1.1/component.json +0 -18
- data/components/chaijs/type-detect/0.1.1/lib/type.js +0 -142
- data/components/component/classes/1.2.1/component.json +0 -19
- data/components/component/classes/1.2.1/index.js +0 -184
- data/components/component/domify/1.2.2/component.json +0 -22
- data/components/component/domify/1.2.2/index.js +0 -87
- data/components/component/event/0.1.3/component.json +0 -13
- data/components/component/event/0.1.3/index.js +0 -35
- data/components/component/jquery/1.9.1/component.json +0 -14
- data/components/component/jquery/1.9.1/index.js +0 -9601
- data/components/component/query/0.0.3/component.json +0 -23
- data/components/component/query/0.0.3/index.js +0 -21
- data/lib/tasks/.gitkeep +0 -0
@@ -1,78 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* chai
|
3
|
-
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
module.exports = function (chai, util) {
|
8
|
-
var Assertion = chai.Assertion;
|
9
|
-
|
10
|
-
function loadShould () {
|
11
|
-
// explicitly define this method as function as to have it's name to include as `ssfi`
|
12
|
-
function shouldGetter() {
|
13
|
-
if (this instanceof String || this instanceof Number) {
|
14
|
-
return new Assertion(this.constructor(this), null, shouldGetter);
|
15
|
-
} else if (this instanceof Boolean) {
|
16
|
-
return new Assertion(this == true, null, shouldGetter);
|
17
|
-
}
|
18
|
-
return new Assertion(this, null, shouldGetter);
|
19
|
-
}
|
20
|
-
function shouldSetter(value) {
|
21
|
-
// See https://github.com/chaijs/chai/issues/86: this makes
|
22
|
-
// `whatever.should = someValue` actually set `someValue`, which is
|
23
|
-
// especially useful for `global.should = require('chai').should()`.
|
24
|
-
//
|
25
|
-
// Note that we have to use [[DefineProperty]] instead of [[Put]]
|
26
|
-
// since otherwise we would trigger this very setter!
|
27
|
-
Object.defineProperty(this, 'should', {
|
28
|
-
value: value,
|
29
|
-
enumerable: true,
|
30
|
-
configurable: true,
|
31
|
-
writable: true
|
32
|
-
});
|
33
|
-
}
|
34
|
-
// modify Object.prototype to have `should`
|
35
|
-
Object.defineProperty(Object.prototype, 'should', {
|
36
|
-
set: shouldSetter
|
37
|
-
, get: shouldGetter
|
38
|
-
, configurable: true
|
39
|
-
});
|
40
|
-
|
41
|
-
var should = {};
|
42
|
-
|
43
|
-
should.equal = function (val1, val2, msg) {
|
44
|
-
new Assertion(val1, msg).to.equal(val2);
|
45
|
-
};
|
46
|
-
|
47
|
-
should.Throw = function (fn, errt, errs, msg) {
|
48
|
-
new Assertion(fn, msg).to.Throw(errt, errs);
|
49
|
-
};
|
50
|
-
|
51
|
-
should.exist = function (val, msg) {
|
52
|
-
new Assertion(val, msg).to.exist;
|
53
|
-
}
|
54
|
-
|
55
|
-
// negation
|
56
|
-
should.not = {}
|
57
|
-
|
58
|
-
should.not.equal = function (val1, val2, msg) {
|
59
|
-
new Assertion(val1, msg).to.not.equal(val2);
|
60
|
-
};
|
61
|
-
|
62
|
-
should.not.Throw = function (fn, errt, errs, msg) {
|
63
|
-
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
64
|
-
};
|
65
|
-
|
66
|
-
should.not.exist = function (val, msg) {
|
67
|
-
new Assertion(val, msg).to.not.exist;
|
68
|
-
}
|
69
|
-
|
70
|
-
should['throw'] = should['Throw'];
|
71
|
-
should.not['throw'] = should.not['Throw'];
|
72
|
-
|
73
|
-
return should;
|
74
|
-
};
|
75
|
-
|
76
|
-
chai.should = loadShould;
|
77
|
-
chai.Should = loadShould;
|
78
|
-
};
|
@@ -1,111 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - addChainingMethod utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/*!
|
8
|
-
* Module dependencies
|
9
|
-
*/
|
10
|
-
|
11
|
-
var transferFlags = require('./transferFlags');
|
12
|
-
var flag = require('./flag');
|
13
|
-
var config = require('../config');
|
14
|
-
|
15
|
-
/*!
|
16
|
-
* Module variables
|
17
|
-
*/
|
18
|
-
|
19
|
-
// Check whether `__proto__` is supported
|
20
|
-
var hasProtoSupport = '__proto__' in Object;
|
21
|
-
|
22
|
-
// Without `__proto__` support, this module will need to add properties to a function.
|
23
|
-
// However, some Function.prototype methods cannot be overwritten,
|
24
|
-
// and there seems no easy cross-platform way to detect them (@see chaijs/chai/issues/69).
|
25
|
-
var excludeNames = /^(?:length|name|arguments|caller)$/;
|
26
|
-
|
27
|
-
// Cache `Function` properties
|
28
|
-
var call = Function.prototype.call,
|
29
|
-
apply = Function.prototype.apply;
|
30
|
-
|
31
|
-
/**
|
32
|
-
* ### addChainableMethod (ctx, name, method, chainingBehavior)
|
33
|
-
*
|
34
|
-
* Adds a method to an object, such that the method can also be chained.
|
35
|
-
*
|
36
|
-
* utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
|
37
|
-
* var obj = utils.flag(this, 'object');
|
38
|
-
* new chai.Assertion(obj).to.be.equal(str);
|
39
|
-
* });
|
40
|
-
*
|
41
|
-
* Can also be accessed directly from `chai.Assertion`.
|
42
|
-
*
|
43
|
-
* chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
|
44
|
-
*
|
45
|
-
* The result can then be used as both a method assertion, executing both `method` and
|
46
|
-
* `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
|
47
|
-
*
|
48
|
-
* expect(fooStr).to.be.foo('bar');
|
49
|
-
* expect(fooStr).to.be.foo.equal('foo');
|
50
|
-
*
|
51
|
-
* @param {Object} ctx object to which the method is added
|
52
|
-
* @param {String} name of method to add
|
53
|
-
* @param {Function} method function to be used for `name`, when called
|
54
|
-
* @param {Function} chainingBehavior function to be called every time the property is accessed
|
55
|
-
* @name addChainableMethod
|
56
|
-
* @api public
|
57
|
-
*/
|
58
|
-
|
59
|
-
module.exports = function (ctx, name, method, chainingBehavior) {
|
60
|
-
if (typeof chainingBehavior !== 'function') {
|
61
|
-
chainingBehavior = function () { };
|
62
|
-
}
|
63
|
-
|
64
|
-
var chainableBehavior = {
|
65
|
-
method: method
|
66
|
-
, chainingBehavior: chainingBehavior
|
67
|
-
};
|
68
|
-
|
69
|
-
// save the methods so we can overwrite them later, if we need to.
|
70
|
-
if (!ctx.__methods) {
|
71
|
-
ctx.__methods = {};
|
72
|
-
}
|
73
|
-
ctx.__methods[name] = chainableBehavior;
|
74
|
-
|
75
|
-
Object.defineProperty(ctx, name,
|
76
|
-
{ get: function () {
|
77
|
-
chainableBehavior.chainingBehavior.call(this);
|
78
|
-
|
79
|
-
var assert = function assert() {
|
80
|
-
var old_ssfi = flag(this, 'ssfi');
|
81
|
-
if (old_ssfi && config.includeStack === false)
|
82
|
-
flag(this, 'ssfi', assert);
|
83
|
-
var result = chainableBehavior.method.apply(this, arguments);
|
84
|
-
return result === undefined ? this : result;
|
85
|
-
};
|
86
|
-
|
87
|
-
// Use `__proto__` if available
|
88
|
-
if (hasProtoSupport) {
|
89
|
-
// Inherit all properties from the object by replacing the `Function` prototype
|
90
|
-
var prototype = assert.__proto__ = Object.create(this);
|
91
|
-
// Restore the `call` and `apply` methods from `Function`
|
92
|
-
prototype.call = call;
|
93
|
-
prototype.apply = apply;
|
94
|
-
}
|
95
|
-
// Otherwise, redefine all properties (slow!)
|
96
|
-
else {
|
97
|
-
var asserterNames = Object.getOwnPropertyNames(ctx);
|
98
|
-
asserterNames.forEach(function (asserterName) {
|
99
|
-
if (!excludeNames.test(asserterName)) {
|
100
|
-
var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
101
|
-
Object.defineProperty(assert, asserterName, pd);
|
102
|
-
}
|
103
|
-
});
|
104
|
-
}
|
105
|
-
|
106
|
-
transferFlags(this, assert);
|
107
|
-
return assert;
|
108
|
-
}
|
109
|
-
, configurable: true
|
110
|
-
});
|
111
|
-
};
|
@@ -1,43 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - addMethod utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
var config = require('../config');
|
8
|
-
|
9
|
-
/**
|
10
|
-
* ### .addMethod (ctx, name, method)
|
11
|
-
*
|
12
|
-
* Adds a method to the prototype of an object.
|
13
|
-
*
|
14
|
-
* utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
|
15
|
-
* var obj = utils.flag(this, 'object');
|
16
|
-
* new chai.Assertion(obj).to.be.equal(str);
|
17
|
-
* });
|
18
|
-
*
|
19
|
-
* Can also be accessed directly from `chai.Assertion`.
|
20
|
-
*
|
21
|
-
* chai.Assertion.addMethod('foo', fn);
|
22
|
-
*
|
23
|
-
* Then can be used as any other assertion.
|
24
|
-
*
|
25
|
-
* expect(fooStr).to.be.foo('bar');
|
26
|
-
*
|
27
|
-
* @param {Object} ctx object to which the method is added
|
28
|
-
* @param {String} name of method to add
|
29
|
-
* @param {Function} method function to be used for name
|
30
|
-
* @name addMethod
|
31
|
-
* @api public
|
32
|
-
*/
|
33
|
-
var flag = require('./flag');
|
34
|
-
|
35
|
-
module.exports = function (ctx, name, method) {
|
36
|
-
ctx[name] = function () {
|
37
|
-
var old_ssfi = flag(this, 'ssfi');
|
38
|
-
if (old_ssfi && config.includeStack === false)
|
39
|
-
flag(this, 'ssfi', ctx[name]);
|
40
|
-
var result = method.apply(this, arguments);
|
41
|
-
return result === undefined ? this : result;
|
42
|
-
};
|
43
|
-
};
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - addProperty utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* ### addProperty (ctx, name, getter)
|
9
|
-
*
|
10
|
-
* Adds a property to the prototype of an object.
|
11
|
-
*
|
12
|
-
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
|
13
|
-
* var obj = utils.flag(this, 'object');
|
14
|
-
* new chai.Assertion(obj).to.be.instanceof(Foo);
|
15
|
-
* });
|
16
|
-
*
|
17
|
-
* Can also be accessed directly from `chai.Assertion`.
|
18
|
-
*
|
19
|
-
* chai.Assertion.addProperty('foo', fn);
|
20
|
-
*
|
21
|
-
* Then can be used as any other assertion.
|
22
|
-
*
|
23
|
-
* expect(myFoo).to.be.foo;
|
24
|
-
*
|
25
|
-
* @param {Object} ctx object to which the property is added
|
26
|
-
* @param {String} name of property to add
|
27
|
-
* @param {Function} getter function to be used for name
|
28
|
-
* @name addProperty
|
29
|
-
* @api public
|
30
|
-
*/
|
31
|
-
|
32
|
-
module.exports = function (ctx, name, getter) {
|
33
|
-
Object.defineProperty(ctx, name,
|
34
|
-
{ get: function () {
|
35
|
-
var result = getter.call(this);
|
36
|
-
return result === undefined ? this : result;
|
37
|
-
}
|
38
|
-
, configurable: true
|
39
|
-
});
|
40
|
-
};
|
@@ -1,32 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - flag utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* ### flag(object ,key, [value])
|
9
|
-
*
|
10
|
-
* Get or set a flag value on an object. If a
|
11
|
-
* value is provided it will be set, else it will
|
12
|
-
* return the currently set value or `undefined` if
|
13
|
-
* the value is not set.
|
14
|
-
*
|
15
|
-
* utils.flag(this, 'foo', 'bar'); // setter
|
16
|
-
* utils.flag(this, 'foo'); // getter, returns `bar`
|
17
|
-
*
|
18
|
-
* @param {Object} object (constructed Assertion
|
19
|
-
* @param {String} key
|
20
|
-
* @param {Mixed} value (optional)
|
21
|
-
* @name flag
|
22
|
-
* @api private
|
23
|
-
*/
|
24
|
-
|
25
|
-
module.exports = function (obj, key, value) {
|
26
|
-
var flags = obj.__flags || (obj.__flags = Object.create(null));
|
27
|
-
if (arguments.length === 3) {
|
28
|
-
flags[key] = value;
|
29
|
-
} else {
|
30
|
-
return flags[key];
|
31
|
-
}
|
32
|
-
};
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - getActual utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* # getActual(object, [actual])
|
9
|
-
*
|
10
|
-
* Returns the `actual` value for an Assertion
|
11
|
-
*
|
12
|
-
* @param {Object} object (constructed Assertion)
|
13
|
-
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
14
|
-
*/
|
15
|
-
|
16
|
-
module.exports = function (obj, args) {
|
17
|
-
return args.length > 4 ? args[4] : obj._obj;
|
18
|
-
};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - getEnumerableProperties utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* ### .getEnumerableProperties(object)
|
9
|
-
*
|
10
|
-
* This allows the retrieval of enumerable property names of an object,
|
11
|
-
* inherited or not.
|
12
|
-
*
|
13
|
-
* @param {Object} object
|
14
|
-
* @returns {Array}
|
15
|
-
* @name getEnumerableProperties
|
16
|
-
* @api public
|
17
|
-
*/
|
18
|
-
|
19
|
-
module.exports = function getEnumerableProperties(object) {
|
20
|
-
var result = [];
|
21
|
-
for (var name in object) {
|
22
|
-
result.push(name);
|
23
|
-
}
|
24
|
-
return result;
|
25
|
-
};
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - message composition utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/*!
|
8
|
-
* Module dependancies
|
9
|
-
*/
|
10
|
-
|
11
|
-
var flag = require('./flag')
|
12
|
-
, getActual = require('./getActual')
|
13
|
-
, inspect = require('./inspect')
|
14
|
-
, objDisplay = require('./objDisplay');
|
15
|
-
|
16
|
-
/**
|
17
|
-
* ### .getMessage(object, message, negateMessage)
|
18
|
-
*
|
19
|
-
* Construct the error message based on flags
|
20
|
-
* and template tags. Template tags will return
|
21
|
-
* a stringified inspection of the object referenced.
|
22
|
-
*
|
23
|
-
* Message template tags:
|
24
|
-
* - `#{this}` current asserted object
|
25
|
-
* - `#{act}` actual value
|
26
|
-
* - `#{exp}` expected value
|
27
|
-
*
|
28
|
-
* @param {Object} object (constructed Assertion)
|
29
|
-
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
30
|
-
* @name getMessage
|
31
|
-
* @api public
|
32
|
-
*/
|
33
|
-
|
34
|
-
module.exports = function (obj, args) {
|
35
|
-
var negate = flag(obj, 'negate')
|
36
|
-
, val = flag(obj, 'object')
|
37
|
-
, expected = args[3]
|
38
|
-
, actual = getActual(obj, args)
|
39
|
-
, msg = negate ? args[2] : args[1]
|
40
|
-
, flagMsg = flag(obj, 'message');
|
41
|
-
|
42
|
-
msg = msg || '';
|
43
|
-
msg = msg
|
44
|
-
.replace(/#{this}/g, objDisplay(val))
|
45
|
-
.replace(/#{act}/g, objDisplay(actual))
|
46
|
-
.replace(/#{exp}/g, objDisplay(expected));
|
47
|
-
|
48
|
-
return flagMsg ? flagMsg + ': ' + msg : msg;
|
49
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - getName utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* MIT Licensed
|
5
|
-
*/
|
6
|
-
|
7
|
-
/**
|
8
|
-
* # getName(func)
|
9
|
-
*
|
10
|
-
* Gets the name of a function, in a cross-browser way.
|
11
|
-
*
|
12
|
-
* @param {Function} a function (usually a constructor)
|
13
|
-
*/
|
14
|
-
|
15
|
-
module.exports = function (func) {
|
16
|
-
if (func.name) return func.name;
|
17
|
-
|
18
|
-
var match = /^\s?function ([^(]*)\(/.exec(func);
|
19
|
-
return match && match[1] ? match[1] : "";
|
20
|
-
};
|
@@ -1,102 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Chai - getPathValue utility
|
3
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4
|
-
* @see https://github.com/logicalparadox/filtr
|
5
|
-
* MIT Licensed
|
6
|
-
*/
|
7
|
-
|
8
|
-
/**
|
9
|
-
* ### .getPathValue(path, object)
|
10
|
-
*
|
11
|
-
* This allows the retrieval of values in an
|
12
|
-
* object given a string path.
|
13
|
-
*
|
14
|
-
* var obj = {
|
15
|
-
* prop1: {
|
16
|
-
* arr: ['a', 'b', 'c']
|
17
|
-
* , str: 'Hello'
|
18
|
-
* }
|
19
|
-
* , prop2: {
|
20
|
-
* arr: [ { nested: 'Universe' } ]
|
21
|
-
* , str: 'Hello again!'
|
22
|
-
* }
|
23
|
-
* }
|
24
|
-
*
|
25
|
-
* The following would be the results.
|
26
|
-
*
|
27
|
-
* getPathValue('prop1.str', obj); // Hello
|
28
|
-
* getPathValue('prop1.att[2]', obj); // b
|
29
|
-
* getPathValue('prop2.arr[0].nested', obj); // Universe
|
30
|
-
*
|
31
|
-
* @param {String} path
|
32
|
-
* @param {Object} object
|
33
|
-
* @returns {Object} value or `undefined`
|
34
|
-
* @name getPathValue
|
35
|
-
* @api public
|
36
|
-
*/
|
37
|
-
|
38
|
-
var getPathValue = module.exports = function (path, obj) {
|
39
|
-
var parsed = parsePath(path);
|
40
|
-
return _getPathValue(parsed, obj);
|
41
|
-
};
|
42
|
-
|
43
|
-
/*!
|
44
|
-
* ## parsePath(path)
|
45
|
-
*
|
46
|
-
* Helper function used to parse string object
|
47
|
-
* paths. Use in conjunction with `_getPathValue`.
|
48
|
-
*
|
49
|
-
* var parsed = parsePath('myobject.property.subprop');
|
50
|
-
*
|
51
|
-
* ### Paths:
|
52
|
-
*
|
53
|
-
* * Can be as near infinitely deep and nested
|
54
|
-
* * Arrays are also valid using the formal `myobject.document[3].property`.
|
55
|
-
*
|
56
|
-
* @param {String} path
|
57
|
-
* @returns {Object} parsed
|
58
|
-
* @api private
|
59
|
-
*/
|
60
|
-
|
61
|
-
function parsePath (path) {
|
62
|
-
var str = path.replace(/\[/g, '.[')
|
63
|
-
, parts = str.match(/(\\\.|[^.]+?)+/g);
|
64
|
-
return parts.map(function (value) {
|
65
|
-
var re = /\[(\d+)\]$/
|
66
|
-
, mArr = re.exec(value)
|
67
|
-
if (mArr) return { i: parseFloat(mArr[1]) };
|
68
|
-
else return { p: value };
|
69
|
-
});
|
70
|
-
};
|
71
|
-
|
72
|
-
/*!
|
73
|
-
* ## _getPathValue(parsed, obj)
|
74
|
-
*
|
75
|
-
* Helper companion function for `.parsePath` that returns
|
76
|
-
* the value located at the parsed address.
|
77
|
-
*
|
78
|
-
* var value = getPathValue(parsed, obj);
|
79
|
-
*
|
80
|
-
* @param {Object} parsed definition from `parsePath`.
|
81
|
-
* @param {Object} object to search against
|
82
|
-
* @returns {Object|Undefined} value
|
83
|
-
* @api private
|
84
|
-
*/
|
85
|
-
|
86
|
-
function _getPathValue (parsed, obj) {
|
87
|
-
var tmp = obj
|
88
|
-
, res;
|
89
|
-
for (var i = 0, l = parsed.length; i < l; i++) {
|
90
|
-
var part = parsed[i];
|
91
|
-
if (tmp) {
|
92
|
-
if ('undefined' !== typeof part.p)
|
93
|
-
tmp = tmp[part.p];
|
94
|
-
else if ('undefined' !== typeof part.i)
|
95
|
-
tmp = tmp[part.i];
|
96
|
-
if (i == (l - 1)) res = tmp;
|
97
|
-
} else {
|
98
|
-
res = undefined;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
return res;
|
102
|
-
};
|