ende 0.5.20 → 0.5.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +1 -1
- data/components/indefinido/indemma/master/.gitignore +17 -0
- data/components/indefinido/indemma/master/.ruby-gemset +1 -0
- data/components/indefinido/indemma/master/.ruby-version +1 -0
- data/components/indefinido/indemma/master/Gemfile +12 -0
- data/components/indefinido/indemma/master/Guardfile +39 -0
- data/components/indefinido/indemma/master/History.md +0 -0
- data/components/indefinido/indemma/master/Readme.md +445 -0
- data/components/indefinido/indemma/master/build/development.js +26123 -0
- data/components/indefinido/indemma/master/build/release.js +16741 -0
- data/components/indefinido/indemma/master/build/test.js +26123 -0
- data/components/indefinido/indemma/master/component.json +1 -1
- data/components/indefinido/indemma/master/components/chaijs/assertion-error/1.0.0/component.json +18 -0
- data/components/indefinido/indemma/master/components/chaijs/assertion-error/1.0.0/index.js +110 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.gitignore +22 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.mailmap +1 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.npmignore +14 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.travis.yml +14 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/CONTRIBUTING.md +173 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/History.md +895 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/Makefile +93 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/README.md +99 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/ReleaseNotes.md +482 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/bower.json +27 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/chai.js +4782 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/component.json +50 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/index.js +1 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/karma.conf.js +28 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/karma.sauce.js +41 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/assertion.js +130 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/config.js +50 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +1314 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +1056 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +12 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +78 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +111 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +43 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +40 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +32 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +18 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +49 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +20 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +102 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +35 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +114 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +320 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +49 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +53 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +51 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +54 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +26 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +44 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +45 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai.js +87 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/package.json +42 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/sauce.browsers.js +128 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +7 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +53 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/assert.js +638 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/bootstrap/index.js +22 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +22 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/configuration.js +133 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/display/errors.js +14 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/display/message.js +47 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/expect.js +814 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/globalShould.js +15 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/plugins.js +24 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/should.js +744 -0
- data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/utilities.js +309 -0
- data/components/indefinido/indemma/master/components/chaijs/deep-eql/0.1.3/component.json +20 -0
- data/components/indefinido/indemma/master/components/chaijs/deep-eql/0.1.3/lib/eql.js +257 -0
- data/components/indefinido/indemma/master/components/chaijs/type-detect/0.1.1/component.json +18 -0
- data/components/indefinido/indemma/master/components/chaijs/type-detect/0.1.1/lib/type.js +142 -0
- data/components/indefinido/indemma/master/components/component/bind/1.0.0/component.json +14 -0
- data/components/indefinido/indemma/master/components/component/bind/1.0.0/index.js +23 -0
- data/components/indefinido/indemma/master/components/component/jquery/1.0.0/component.json +10 -0
- data/components/indefinido/indemma/master/components/component/jquery/1.0.0/index.js +10308 -0
- data/components/indefinido/indemma/master/components/component/type/1.0.0/component.json +20 -0
- data/components/indefinido/indemma/master/components/component/type/1.0.0/index.js +32 -0
- data/components/indefinido/indemma/master/components/indefinido/advisable/master/component.json +21 -0
- data/components/indefinido/indemma/master/components/indefinido/advisable/master/index.js +1 -0
- data/components/indefinido/indemma/master/components/indefinido/advisable/master/lib/advisable.js +60 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/component.json +39 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/index.js +1 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/adapters/rivets.js +40 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/legacy/notifierable.js +145 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +147 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/lookup.js +38 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/keypath_observer.js +38 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/observation.js +45 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/selection.js +57 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/self_observer.js +38 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable.js +97 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/platform.js +12 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/observe-js/observe.js +1631 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/accessors-legacy.js +92 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/accessors.js +248 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/array.indexOf.js +8 -0
- data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/object.create.js +77 -0
- data/components/indefinido/indemma/master/components/pluma/assimilate/0.4.0/component.json +25 -0
- data/components/indefinido/indemma/master/components/pluma/assimilate/0.4.0/dist/assimilate.js +127 -0
- data/components/indefinido/indemma/master/karma.conf.js +75 -0
- data/components/indefinido/indemma/master/lib/record/associable.js +4 -2
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +1 -1
- data/components/indefinido/indemma/master/package.json +9 -0
- data/components/indefinido/indemma/master/spec/record/associable_spec.js +211 -0
- data/components/indefinido/indemma/master/spec/record/dirtyable_spec.js +57 -0
- data/components/indefinido/indemma/master/spec/record/maid_spec.js +40 -0
- data/components/indefinido/indemma/master/spec/record/persistable_spec.js +46 -0
- data/components/indefinido/indemma/master/spec/record/queryable_spec.js +39 -0
- data/components/indefinido/indemma/master/spec/record/resource_spec.js +93 -0
- data/components/indefinido/indemma/master/spec/record/rest_spec.js +32 -0
- data/components/indefinido/indemma/master/spec/record/restfulable_spec.js +346 -0
- data/components/indefinido/indemma/master/spec/record/scopable_spec.js +242 -0
- data/components/indefinido/indemma/master/spec/record/storable_spec.js +44 -0
- data/components/indefinido/indemma/master/spec/record/translationable.js +28 -0
- data/components/indefinido/indemma/master/spec/record/validatable_spec.js +142 -0
- data/components/indefinido/indemma/master/spec/record/validations/associated_spec.js +43 -0
- data/components/indefinido/indemma/master/spec/record/validations/confirmation_spec.js +36 -0
- data/components/indefinido/indemma/master/spec/record/validations/cpf_spec.js +34 -0
- data/components/indefinido/indemma/master/spec/record/validations/presence_spec.js +28 -0
- data/components/indefinido/indemma/master/spec/record/validations/remote_spec.js +87 -0
- data/components/indefinido/indemma/master/spec/record/validations/type_spec.js +48 -0
- data/components/indefinido/indemma/master/spec/record_spec.js +49 -0
- data/components/indefinido/indemma/master/spec/spec_helper.js +15 -0
- data/components/indefinido/indemma/master/spec/support/value_objects/phone.js +45 -0
- data/components/indefinido/indemma/master/src/lib/extensions/rivets.coffee +17 -0
- data/components/indefinido/indemma/master/src/lib/record/associable.coffee +419 -0
- data/components/indefinido/indemma/master/src/lib/record/dirtyable.coffee +47 -0
- data/components/indefinido/indemma/master/src/lib/record/errors.coffee +20 -0
- data/components/indefinido/indemma/master/src/lib/record/maid.coffee +16 -0
- data/components/indefinido/indemma/master/src/lib/record/persistable.coffee +34 -0
- data/components/indefinido/indemma/master/src/lib/record/queryable.coffee +29 -0
- data/components/indefinido/indemma/master/src/lib/record/resource.coffee +107 -0
- data/components/indefinido/indemma/master/src/lib/record/rest.coffee +34 -0
- data/components/indefinido/indemma/master/src/lib/record/restfulable.coffee +487 -0
- data/components/indefinido/indemma/master/src/lib/record/scopable.coffee +279 -0
- data/components/indefinido/indemma/master/src/lib/record/storable.coffee +49 -0
- data/components/indefinido/indemma/master/src/lib/record/translationable.coffee +18 -0
- data/components/indefinido/indemma/master/src/lib/record/validatable.coffee +241 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/associated.coffee +34 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/confirmation.coffee +17 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/cpf.coffee +57 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/presence.coffee +16 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/remote.coffee +61 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/type.coffee +31 -0
- data/components/indefinido/indemma/master/src/lib/record/validations/validatorable.coffee +5 -0
- data/components/indefinido/indemma/master/src/lib/record.coffee +143 -0
- data/components/indefinido/indemma/master/src/spec/record/associable_spec.coffee +205 -0
- data/components/indefinido/indemma/master/src/spec/record/dirtyable_spec.coffee +47 -0
- data/components/indefinido/indemma/master/src/spec/record/maid_spec.coffee +34 -0
- data/components/indefinido/indemma/master/src/spec/record/persistable_spec.coffee +39 -0
- data/components/indefinido/indemma/master/src/spec/record/queryable_spec.coffee +33 -0
- data/components/indefinido/indemma/master/src/spec/record/resource_spec.coffee +69 -0
- data/components/indefinido/indemma/master/src/spec/record/rest_spec.coffee +22 -0
- data/components/indefinido/indemma/master/src/spec/record/restfulable_spec.coffee +257 -0
- data/components/indefinido/indemma/master/src/spec/record/scopable_spec.coffee +227 -0
- data/components/indefinido/indemma/master/src/spec/record/storable_spec.coffee +39 -0
- data/components/indefinido/indemma/master/src/spec/record/translationable.coffee +19 -0
- data/components/indefinido/indemma/master/src/spec/record/validatable_spec.coffee +127 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/associated_spec.coffee +35 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/confirmation_spec.coffee +25 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/cpf_spec.coffee +27 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/presence_spec.coffee +24 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/remote_spec.coffee +74 -0
- data/components/indefinido/indemma/master/src/spec/record/validations/type_spec.coffee +33 -0
- data/components/indefinido/indemma/master/src/spec/record_spec.coffee +29 -0
- data/components/indefinido/indemma/master/src/spec/spec_helper.coffee +11 -0
- data/components/indefinido/indemma/master/src/spec/support/value_objects/phone.coffee +30 -0
- data/components/indefinido/indemma/master/vendor/object/mixin.js +196 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/assert.js +199 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/behavior.js +334 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/call.js +205 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/collection.js +155 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/match.js +245 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/mock.js +451 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/sandbox.js +144 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/spy.js +413 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/stub.js +161 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/test.js +77 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/test_case.js +99 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/event.js +94 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_server.js +212 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_server_with_clock.js +83 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_timers.js +405 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_xdomain_request.js +206 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_xml_http_request.js +575 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/timers_ie.js +31 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/xdr_ie.js +14 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon/util/xhr_ie.js +19 -0
- data/components/indefinido/indemma/master/vendor/spec/sinon.js +383 -0
- data/lib/assets/javascripts/value_objects/phone.js.coffee +3 -1
- data/lib/assets/javascripts/widgets/viewer/plugins/scopable.js.coffee +5 -5
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/ende_build.css +4 -4
- data/vendor/assets/components/ende_build.js +7974 -7889
- metadata +191 -5
- data/vendor/assets/component/build.css +0 -112
- data/vendor/assets/components/build.css +0 -112
- data/vendor/assets/components/indemma_with_none.js +0 -30553
@@ -0,0 +1,334 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
*/
|
4
|
+
/*jslint eqeqeq: false, onevar: false*/
|
5
|
+
/*global module, require, sinon, process, setImmediate, setTimeout*/
|
6
|
+
/**
|
7
|
+
* Stub behavior
|
8
|
+
*
|
9
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
10
|
+
* @author Tim Fischbach (mail@timfischbach.de)
|
11
|
+
* @license BSD
|
12
|
+
*
|
13
|
+
* Copyright (c) 2010-2013 Christian Johansen
|
14
|
+
*/
|
15
|
+
"use strict";
|
16
|
+
|
17
|
+
(function (sinon) {
|
18
|
+
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
|
19
|
+
|
20
|
+
if (!sinon && commonJSModule) {
|
21
|
+
sinon = require("../sinon");
|
22
|
+
}
|
23
|
+
|
24
|
+
if (!sinon) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
var slice = Array.prototype.slice;
|
29
|
+
var join = Array.prototype.join;
|
30
|
+
var proto;
|
31
|
+
|
32
|
+
var nextTick = (function () {
|
33
|
+
if (typeof process === "object" && typeof process.nextTick === "function") {
|
34
|
+
return process.nextTick;
|
35
|
+
} else if (typeof setImmediate === "function") {
|
36
|
+
return setImmediate;
|
37
|
+
} else {
|
38
|
+
return function (callback) {
|
39
|
+
setTimeout(callback, 0);
|
40
|
+
};
|
41
|
+
}
|
42
|
+
})();
|
43
|
+
|
44
|
+
function throwsException(error, message) {
|
45
|
+
if (typeof error == "string") {
|
46
|
+
this.exception = new Error(message || "");
|
47
|
+
this.exception.name = error;
|
48
|
+
} else if (!error) {
|
49
|
+
this.exception = new Error("Error");
|
50
|
+
} else {
|
51
|
+
this.exception = error;
|
52
|
+
}
|
53
|
+
|
54
|
+
return this;
|
55
|
+
}
|
56
|
+
|
57
|
+
function getCallback(behavior, args) {
|
58
|
+
var callArgAt = behavior.callArgAt;
|
59
|
+
|
60
|
+
if (callArgAt < 0) {
|
61
|
+
var callArgProp = behavior.callArgProp;
|
62
|
+
|
63
|
+
for (var i = 0, l = args.length; i < l; ++i) {
|
64
|
+
if (!callArgProp && typeof args[i] == "function") {
|
65
|
+
return args[i];
|
66
|
+
}
|
67
|
+
|
68
|
+
if (callArgProp && args[i] &&
|
69
|
+
typeof args[i][callArgProp] == "function") {
|
70
|
+
return args[i][callArgProp];
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
return null;
|
75
|
+
}
|
76
|
+
|
77
|
+
return args[callArgAt];
|
78
|
+
}
|
79
|
+
|
80
|
+
function getCallbackError(behavior, func, args) {
|
81
|
+
if (behavior.callArgAt < 0) {
|
82
|
+
var msg;
|
83
|
+
|
84
|
+
if (behavior.callArgProp) {
|
85
|
+
msg = sinon.functionName(behavior.stub) +
|
86
|
+
" expected to yield to '" + behavior.callArgProp +
|
87
|
+
"', but no object with such a property was passed.";
|
88
|
+
} else {
|
89
|
+
msg = sinon.functionName(behavior.stub) +
|
90
|
+
" expected to yield, but no callback was passed.";
|
91
|
+
}
|
92
|
+
|
93
|
+
if (args.length > 0) {
|
94
|
+
msg += " Received [" + join.call(args, ", ") + "]";
|
95
|
+
}
|
96
|
+
|
97
|
+
return msg;
|
98
|
+
}
|
99
|
+
|
100
|
+
return "argument at index " + behavior.callArgAt + " is not a function: " + func;
|
101
|
+
}
|
102
|
+
|
103
|
+
function callCallback(behavior, args) {
|
104
|
+
if (typeof behavior.callArgAt == "number") {
|
105
|
+
var func = getCallback(behavior, args);
|
106
|
+
|
107
|
+
if (typeof func != "function") {
|
108
|
+
throw new TypeError(getCallbackError(behavior, func, args));
|
109
|
+
}
|
110
|
+
|
111
|
+
if (behavior.callbackAsync) {
|
112
|
+
nextTick(function() {
|
113
|
+
func.apply(behavior.callbackContext, behavior.callbackArguments);
|
114
|
+
});
|
115
|
+
} else {
|
116
|
+
func.apply(behavior.callbackContext, behavior.callbackArguments);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
proto = {
|
122
|
+
create: function(stub) {
|
123
|
+
var behavior = sinon.extend({}, sinon.behavior);
|
124
|
+
delete behavior.create;
|
125
|
+
behavior.stub = stub;
|
126
|
+
|
127
|
+
return behavior;
|
128
|
+
},
|
129
|
+
|
130
|
+
isPresent: function() {
|
131
|
+
return (typeof this.callArgAt == 'number' ||
|
132
|
+
this.exception ||
|
133
|
+
typeof this.returnArgAt == 'number' ||
|
134
|
+
this.returnThis ||
|
135
|
+
this.returnValueDefined);
|
136
|
+
},
|
137
|
+
|
138
|
+
invoke: function(context, args) {
|
139
|
+
callCallback(this, args);
|
140
|
+
|
141
|
+
if (this.exception) {
|
142
|
+
throw this.exception;
|
143
|
+
} else if (typeof this.returnArgAt == 'number') {
|
144
|
+
return args[this.returnArgAt];
|
145
|
+
} else if (this.returnThis) {
|
146
|
+
return context;
|
147
|
+
}
|
148
|
+
|
149
|
+
return this.returnValue;
|
150
|
+
},
|
151
|
+
|
152
|
+
onCall: function(index) {
|
153
|
+
return this.stub.onCall(index);
|
154
|
+
},
|
155
|
+
|
156
|
+
onFirstCall: function() {
|
157
|
+
return this.stub.onFirstCall();
|
158
|
+
},
|
159
|
+
|
160
|
+
onSecondCall: function() {
|
161
|
+
return this.stub.onSecondCall();
|
162
|
+
},
|
163
|
+
|
164
|
+
onThirdCall: function() {
|
165
|
+
return this.stub.onThirdCall();
|
166
|
+
},
|
167
|
+
|
168
|
+
withArgs: function(/* arguments */) {
|
169
|
+
throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. ' +
|
170
|
+
'Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.');
|
171
|
+
},
|
172
|
+
|
173
|
+
callsArg: function callsArg(pos) {
|
174
|
+
if (typeof pos != "number") {
|
175
|
+
throw new TypeError("argument index is not number");
|
176
|
+
}
|
177
|
+
|
178
|
+
this.callArgAt = pos;
|
179
|
+
this.callbackArguments = [];
|
180
|
+
this.callbackContext = undefined;
|
181
|
+
this.callArgProp = undefined;
|
182
|
+
this.callbackAsync = false;
|
183
|
+
|
184
|
+
return this;
|
185
|
+
},
|
186
|
+
|
187
|
+
callsArgOn: function callsArgOn(pos, context) {
|
188
|
+
if (typeof pos != "number") {
|
189
|
+
throw new TypeError("argument index is not number");
|
190
|
+
}
|
191
|
+
if (typeof context != "object") {
|
192
|
+
throw new TypeError("argument context is not an object");
|
193
|
+
}
|
194
|
+
|
195
|
+
this.callArgAt = pos;
|
196
|
+
this.callbackArguments = [];
|
197
|
+
this.callbackContext = context;
|
198
|
+
this.callArgProp = undefined;
|
199
|
+
this.callbackAsync = false;
|
200
|
+
|
201
|
+
return this;
|
202
|
+
},
|
203
|
+
|
204
|
+
callsArgWith: function callsArgWith(pos) {
|
205
|
+
if (typeof pos != "number") {
|
206
|
+
throw new TypeError("argument index is not number");
|
207
|
+
}
|
208
|
+
|
209
|
+
this.callArgAt = pos;
|
210
|
+
this.callbackArguments = slice.call(arguments, 1);
|
211
|
+
this.callbackContext = undefined;
|
212
|
+
this.callArgProp = undefined;
|
213
|
+
this.callbackAsync = false;
|
214
|
+
|
215
|
+
return this;
|
216
|
+
},
|
217
|
+
|
218
|
+
callsArgOnWith: function callsArgWith(pos, context) {
|
219
|
+
if (typeof pos != "number") {
|
220
|
+
throw new TypeError("argument index is not number");
|
221
|
+
}
|
222
|
+
if (typeof context != "object") {
|
223
|
+
throw new TypeError("argument context is not an object");
|
224
|
+
}
|
225
|
+
|
226
|
+
this.callArgAt = pos;
|
227
|
+
this.callbackArguments = slice.call(arguments, 2);
|
228
|
+
this.callbackContext = context;
|
229
|
+
this.callArgProp = undefined;
|
230
|
+
this.callbackAsync = false;
|
231
|
+
|
232
|
+
return this;
|
233
|
+
},
|
234
|
+
|
235
|
+
yields: function () {
|
236
|
+
this.callArgAt = -1;
|
237
|
+
this.callbackArguments = slice.call(arguments, 0);
|
238
|
+
this.callbackContext = undefined;
|
239
|
+
this.callArgProp = undefined;
|
240
|
+
this.callbackAsync = false;
|
241
|
+
|
242
|
+
return this;
|
243
|
+
},
|
244
|
+
|
245
|
+
yieldsOn: function (context) {
|
246
|
+
if (typeof context != "object") {
|
247
|
+
throw new TypeError("argument context is not an object");
|
248
|
+
}
|
249
|
+
|
250
|
+
this.callArgAt = -1;
|
251
|
+
this.callbackArguments = slice.call(arguments, 1);
|
252
|
+
this.callbackContext = context;
|
253
|
+
this.callArgProp = undefined;
|
254
|
+
this.callbackAsync = false;
|
255
|
+
|
256
|
+
return this;
|
257
|
+
},
|
258
|
+
|
259
|
+
yieldsTo: function (prop) {
|
260
|
+
this.callArgAt = -1;
|
261
|
+
this.callbackArguments = slice.call(arguments, 1);
|
262
|
+
this.callbackContext = undefined;
|
263
|
+
this.callArgProp = prop;
|
264
|
+
this.callbackAsync = false;
|
265
|
+
|
266
|
+
return this;
|
267
|
+
},
|
268
|
+
|
269
|
+
yieldsToOn: function (prop, context) {
|
270
|
+
if (typeof context != "object") {
|
271
|
+
throw new TypeError("argument context is not an object");
|
272
|
+
}
|
273
|
+
|
274
|
+
this.callArgAt = -1;
|
275
|
+
this.callbackArguments = slice.call(arguments, 2);
|
276
|
+
this.callbackContext = context;
|
277
|
+
this.callArgProp = prop;
|
278
|
+
this.callbackAsync = false;
|
279
|
+
|
280
|
+
return this;
|
281
|
+
},
|
282
|
+
|
283
|
+
|
284
|
+
"throws": throwsException,
|
285
|
+
throwsException: throwsException,
|
286
|
+
|
287
|
+
returns: function returns(value) {
|
288
|
+
this.returnValue = value;
|
289
|
+
this.returnValueDefined = true;
|
290
|
+
|
291
|
+
return this;
|
292
|
+
},
|
293
|
+
|
294
|
+
returnsArg: function returnsArg(pos) {
|
295
|
+
if (typeof pos != "number") {
|
296
|
+
throw new TypeError("argument index is not number");
|
297
|
+
}
|
298
|
+
|
299
|
+
this.returnArgAt = pos;
|
300
|
+
|
301
|
+
return this;
|
302
|
+
},
|
303
|
+
|
304
|
+
returnsThis: function returnsThis() {
|
305
|
+
this.returnThis = true;
|
306
|
+
|
307
|
+
return this;
|
308
|
+
}
|
309
|
+
};
|
310
|
+
|
311
|
+
// create asynchronous versions of callsArg* and yields* methods
|
312
|
+
for (var method in proto) {
|
313
|
+
// need to avoid creating anotherasync versions of the newly added async methods
|
314
|
+
if (proto.hasOwnProperty(method) &&
|
315
|
+
method.match(/^(callsArg|yields)/) &&
|
316
|
+
!method.match(/Async/)) {
|
317
|
+
proto[method + 'Async'] = (function (syncFnName) {
|
318
|
+
return function () {
|
319
|
+
var result = this[syncFnName].apply(this, arguments);
|
320
|
+
this.callbackAsync = true;
|
321
|
+
return result;
|
322
|
+
};
|
323
|
+
})(method);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
sinon.behavior = proto;
|
328
|
+
|
329
|
+
if (typeof define === "function" && define.amd) {
|
330
|
+
define(["module"], function(module) { module.exports = proto; });
|
331
|
+
} else if (commonJSModule) {
|
332
|
+
module.exports = proto;
|
333
|
+
}
|
334
|
+
}(typeof sinon == "object" && sinon || null));
|
@@ -0,0 +1,205 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
* @depend match.js
|
4
|
+
*/
|
5
|
+
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
|
6
|
+
/*global module, require, sinon*/
|
7
|
+
/**
|
8
|
+
* Spy calls
|
9
|
+
*
|
10
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
11
|
+
* @author Maximilian Antoni (mail@maxantoni.de)
|
12
|
+
* @license BSD
|
13
|
+
*
|
14
|
+
* Copyright (c) 2010-2013 Christian Johansen
|
15
|
+
* Copyright (c) 2013 Maximilian Antoni
|
16
|
+
*/
|
17
|
+
"use strict";
|
18
|
+
|
19
|
+
(function (sinon) {
|
20
|
+
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
|
21
|
+
if (!sinon && commonJSModule) {
|
22
|
+
sinon = require("../sinon");
|
23
|
+
}
|
24
|
+
|
25
|
+
if (!sinon) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
|
29
|
+
function throwYieldError(proxy, text, args) {
|
30
|
+
var msg = sinon.functionName(proxy) + text;
|
31
|
+
if (args.length) {
|
32
|
+
msg += " Received [" + slice.call(args).join(", ") + "]";
|
33
|
+
}
|
34
|
+
throw new Error(msg);
|
35
|
+
}
|
36
|
+
|
37
|
+
var slice = Array.prototype.slice;
|
38
|
+
|
39
|
+
var callProto = {
|
40
|
+
calledOn: function calledOn(thisValue) {
|
41
|
+
if (sinon.match && sinon.match.isMatcher(thisValue)) {
|
42
|
+
return thisValue.test(this.thisValue);
|
43
|
+
}
|
44
|
+
return this.thisValue === thisValue;
|
45
|
+
},
|
46
|
+
|
47
|
+
calledWith: function calledWith() {
|
48
|
+
for (var i = 0, l = arguments.length; i < l; i += 1) {
|
49
|
+
if (!sinon.deepEqual(arguments[i], this.args[i])) {
|
50
|
+
return false;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
return true;
|
55
|
+
},
|
56
|
+
|
57
|
+
calledWithMatch: function calledWithMatch() {
|
58
|
+
for (var i = 0, l = arguments.length; i < l; i += 1) {
|
59
|
+
var actual = this.args[i];
|
60
|
+
var expectation = arguments[i];
|
61
|
+
if (!sinon.match || !sinon.match(expectation).test(actual)) {
|
62
|
+
return false;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return true;
|
66
|
+
},
|
67
|
+
|
68
|
+
calledWithExactly: function calledWithExactly() {
|
69
|
+
return arguments.length == this.args.length &&
|
70
|
+
this.calledWith.apply(this, arguments);
|
71
|
+
},
|
72
|
+
|
73
|
+
notCalledWith: function notCalledWith() {
|
74
|
+
return !this.calledWith.apply(this, arguments);
|
75
|
+
},
|
76
|
+
|
77
|
+
notCalledWithMatch: function notCalledWithMatch() {
|
78
|
+
return !this.calledWithMatch.apply(this, arguments);
|
79
|
+
},
|
80
|
+
|
81
|
+
returned: function returned(value) {
|
82
|
+
return sinon.deepEqual(value, this.returnValue);
|
83
|
+
},
|
84
|
+
|
85
|
+
threw: function threw(error) {
|
86
|
+
if (typeof error === "undefined" || !this.exception) {
|
87
|
+
return !!this.exception;
|
88
|
+
}
|
89
|
+
|
90
|
+
return this.exception === error || this.exception.name === error;
|
91
|
+
},
|
92
|
+
|
93
|
+
calledWithNew: function calledWithNew() {
|
94
|
+
return this.proxy.prototype && this.thisValue instanceof this.proxy;
|
95
|
+
},
|
96
|
+
|
97
|
+
calledBefore: function (other) {
|
98
|
+
return this.callId < other.callId;
|
99
|
+
},
|
100
|
+
|
101
|
+
calledAfter: function (other) {
|
102
|
+
return this.callId > other.callId;
|
103
|
+
},
|
104
|
+
|
105
|
+
callArg: function (pos) {
|
106
|
+
this.args[pos]();
|
107
|
+
},
|
108
|
+
|
109
|
+
callArgOn: function (pos, thisValue) {
|
110
|
+
this.args[pos].apply(thisValue);
|
111
|
+
},
|
112
|
+
|
113
|
+
callArgWith: function (pos) {
|
114
|
+
this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
|
115
|
+
},
|
116
|
+
|
117
|
+
callArgOnWith: function (pos, thisValue) {
|
118
|
+
var args = slice.call(arguments, 2);
|
119
|
+
this.args[pos].apply(thisValue, args);
|
120
|
+
},
|
121
|
+
|
122
|
+
"yield": function () {
|
123
|
+
this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
|
124
|
+
},
|
125
|
+
|
126
|
+
yieldOn: function (thisValue) {
|
127
|
+
var args = this.args;
|
128
|
+
for (var i = 0, l = args.length; i < l; ++i) {
|
129
|
+
if (typeof args[i] === "function") {
|
130
|
+
args[i].apply(thisValue, slice.call(arguments, 1));
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
|
135
|
+
},
|
136
|
+
|
137
|
+
yieldTo: function (prop) {
|
138
|
+
this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
|
139
|
+
},
|
140
|
+
|
141
|
+
yieldToOn: function (prop, thisValue) {
|
142
|
+
var args = this.args;
|
143
|
+
for (var i = 0, l = args.length; i < l; ++i) {
|
144
|
+
if (args[i] && typeof args[i][prop] === "function") {
|
145
|
+
args[i][prop].apply(thisValue, slice.call(arguments, 2));
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
throwYieldError(this.proxy, " cannot yield to '" + prop +
|
150
|
+
"' since no callback was passed.", args);
|
151
|
+
},
|
152
|
+
|
153
|
+
toString: function () {
|
154
|
+
var callStr = this.proxy.toString() + "(";
|
155
|
+
var args = [];
|
156
|
+
|
157
|
+
for (var i = 0, l = this.args.length; i < l; ++i) {
|
158
|
+
args.push(sinon.format(this.args[i]));
|
159
|
+
}
|
160
|
+
|
161
|
+
callStr = callStr + args.join(", ") + ")";
|
162
|
+
|
163
|
+
if (typeof this.returnValue != "undefined") {
|
164
|
+
callStr += " => " + sinon.format(this.returnValue);
|
165
|
+
}
|
166
|
+
|
167
|
+
if (this.exception) {
|
168
|
+
callStr += " !" + this.exception.name;
|
169
|
+
|
170
|
+
if (this.exception.message) {
|
171
|
+
callStr += "(" + this.exception.message + ")";
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
return callStr;
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
callProto.invokeCallback = callProto.yield;
|
180
|
+
|
181
|
+
function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
|
182
|
+
if (typeof id !== "number") {
|
183
|
+
throw new TypeError("Call id is not a number");
|
184
|
+
}
|
185
|
+
var proxyCall = sinon.create(callProto);
|
186
|
+
proxyCall.proxy = spy;
|
187
|
+
proxyCall.thisValue = thisValue;
|
188
|
+
proxyCall.args = args;
|
189
|
+
proxyCall.returnValue = returnValue;
|
190
|
+
proxyCall.exception = exception;
|
191
|
+
proxyCall.callId = id;
|
192
|
+
|
193
|
+
return proxyCall;
|
194
|
+
}
|
195
|
+
createSpyCall.toString = callProto.toString; // used by mocks
|
196
|
+
|
197
|
+
sinon.spyCall = createSpyCall;
|
198
|
+
|
199
|
+
if (typeof define === "function" && define.amd) {
|
200
|
+
define(["module"], function(module) { module.exports = createSpyCall; });
|
201
|
+
} else if (commonJSModule) {
|
202
|
+
module.exports = createSpyCall;
|
203
|
+
}
|
204
|
+
}(typeof sinon == "object" && sinon || null));
|
205
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
* @depend stub.js
|
4
|
+
* @depend mock.js
|
5
|
+
*/
|
6
|
+
/*jslint eqeqeq: false, onevar: false, forin: true*/
|
7
|
+
/*global module, require, sinon*/
|
8
|
+
/**
|
9
|
+
* Collections of stubs, spies and mocks.
|
10
|
+
*
|
11
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
12
|
+
* @license BSD
|
13
|
+
*
|
14
|
+
* Copyright (c) 2010-2013 Christian Johansen
|
15
|
+
*/
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
(function (sinon) {
|
19
|
+
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
|
20
|
+
var push = [].push;
|
21
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
22
|
+
|
23
|
+
if (!sinon && commonJSModule) {
|
24
|
+
sinon = require("../sinon");
|
25
|
+
}
|
26
|
+
|
27
|
+
if (!sinon) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
function getFakes(fakeCollection) {
|
32
|
+
if (!fakeCollection.fakes) {
|
33
|
+
fakeCollection.fakes = [];
|
34
|
+
}
|
35
|
+
|
36
|
+
return fakeCollection.fakes;
|
37
|
+
}
|
38
|
+
|
39
|
+
function each(fakeCollection, method) {
|
40
|
+
var fakes = getFakes(fakeCollection);
|
41
|
+
|
42
|
+
for (var i = 0, l = fakes.length; i < l; i += 1) {
|
43
|
+
if (typeof fakes[i][method] == "function") {
|
44
|
+
fakes[i][method]();
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function compact(fakeCollection) {
|
50
|
+
var fakes = getFakes(fakeCollection);
|
51
|
+
var i = 0;
|
52
|
+
while (i < fakes.length) {
|
53
|
+
fakes.splice(i, 1);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
var collection = {
|
58
|
+
verify: function resolve() {
|
59
|
+
each(this, "verify");
|
60
|
+
},
|
61
|
+
|
62
|
+
restore: function restore() {
|
63
|
+
each(this, "restore");
|
64
|
+
compact(this);
|
65
|
+
},
|
66
|
+
|
67
|
+
verifyAndRestore: function verifyAndRestore() {
|
68
|
+
var exception;
|
69
|
+
|
70
|
+
try {
|
71
|
+
this.verify();
|
72
|
+
} catch (e) {
|
73
|
+
exception = e;
|
74
|
+
}
|
75
|
+
|
76
|
+
this.restore();
|
77
|
+
|
78
|
+
if (exception) {
|
79
|
+
throw exception;
|
80
|
+
}
|
81
|
+
},
|
82
|
+
|
83
|
+
add: function add(fake) {
|
84
|
+
push.call(getFakes(this), fake);
|
85
|
+
return fake;
|
86
|
+
},
|
87
|
+
|
88
|
+
spy: function spy() {
|
89
|
+
return this.add(sinon.spy.apply(sinon, arguments));
|
90
|
+
},
|
91
|
+
|
92
|
+
stub: function stub(object, property, value) {
|
93
|
+
if (property) {
|
94
|
+
var original = object[property];
|
95
|
+
|
96
|
+
if (typeof original != "function") {
|
97
|
+
if (!hasOwnProperty.call(object, property)) {
|
98
|
+
throw new TypeError("Cannot stub non-existent own property " + property);
|
99
|
+
}
|
100
|
+
|
101
|
+
object[property] = value;
|
102
|
+
|
103
|
+
return this.add({
|
104
|
+
restore: function () {
|
105
|
+
object[property] = original;
|
106
|
+
}
|
107
|
+
});
|
108
|
+
}
|
109
|
+
}
|
110
|
+
if (!property && !!object && typeof object == "object") {
|
111
|
+
var stubbedObj = sinon.stub.apply(sinon, arguments);
|
112
|
+
|
113
|
+
for (var prop in stubbedObj) {
|
114
|
+
if (typeof stubbedObj[prop] === "function") {
|
115
|
+
this.add(stubbedObj[prop]);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
return stubbedObj;
|
120
|
+
}
|
121
|
+
|
122
|
+
return this.add(sinon.stub.apply(sinon, arguments));
|
123
|
+
},
|
124
|
+
|
125
|
+
mock: function mock() {
|
126
|
+
return this.add(sinon.mock.apply(sinon, arguments));
|
127
|
+
},
|
128
|
+
|
129
|
+
inject: function inject(obj) {
|
130
|
+
var col = this;
|
131
|
+
|
132
|
+
obj.spy = function () {
|
133
|
+
return col.spy.apply(col, arguments);
|
134
|
+
};
|
135
|
+
|
136
|
+
obj.stub = function () {
|
137
|
+
return col.stub.apply(col, arguments);
|
138
|
+
};
|
139
|
+
|
140
|
+
obj.mock = function () {
|
141
|
+
return col.mock.apply(col, arguments);
|
142
|
+
};
|
143
|
+
|
144
|
+
return obj;
|
145
|
+
}
|
146
|
+
};
|
147
|
+
|
148
|
+
sinon.collection = collection;
|
149
|
+
|
150
|
+
if (typeof define === "function" && define.amd) {
|
151
|
+
define(["module"], function(module) { module.exports = collection; });
|
152
|
+
} else if (commonJSModule) {
|
153
|
+
module.exports = collection;
|
154
|
+
}
|
155
|
+
}(typeof sinon == "object" && sinon || null));
|