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,144 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
* @depend collection.js
|
4
|
+
* @depend util/fake_timers.js
|
5
|
+
* @depend util/fake_server_with_clock.js
|
6
|
+
*/
|
7
|
+
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
|
8
|
+
/*global require, module*/
|
9
|
+
/**
|
10
|
+
* Manages fake collections as well as fake utilities such as Sinon's
|
11
|
+
* timers and fake XHR implementation in one convenient object.
|
12
|
+
*
|
13
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
14
|
+
* @license BSD
|
15
|
+
*
|
16
|
+
* Copyright (c) 2010-2013 Christian Johansen
|
17
|
+
*/
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
if (typeof module !== "undefined" && module.exports && typeof require == "function") {
|
21
|
+
var sinon = require("../sinon");
|
22
|
+
sinon.extend(sinon, require("./util/fake_timers"));
|
23
|
+
}
|
24
|
+
|
25
|
+
(function () {
|
26
|
+
var push = [].push;
|
27
|
+
|
28
|
+
function exposeValue(sandbox, config, key, value) {
|
29
|
+
if (!value) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
if (config.injectInto && !(key in config.injectInto)) {
|
34
|
+
config.injectInto[key] = value;
|
35
|
+
sandbox.injectedKeys.push(key);
|
36
|
+
} else {
|
37
|
+
push.call(sandbox.args, value);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
function prepareSandboxFromConfig(config) {
|
42
|
+
var sandbox = sinon.create(sinon.sandbox);
|
43
|
+
|
44
|
+
if (config.useFakeServer) {
|
45
|
+
if (typeof config.useFakeServer == "object") {
|
46
|
+
sandbox.serverPrototype = config.useFakeServer;
|
47
|
+
}
|
48
|
+
|
49
|
+
sandbox.useFakeServer();
|
50
|
+
}
|
51
|
+
|
52
|
+
if (config.useFakeTimers) {
|
53
|
+
if (typeof config.useFakeTimers == "object") {
|
54
|
+
sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers);
|
55
|
+
} else {
|
56
|
+
sandbox.useFakeTimers();
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
return sandbox;
|
61
|
+
}
|
62
|
+
|
63
|
+
sinon.sandbox = sinon.extend(sinon.create(sinon.collection), {
|
64
|
+
useFakeTimers: function useFakeTimers() {
|
65
|
+
this.clock = sinon.useFakeTimers.apply(sinon, arguments);
|
66
|
+
|
67
|
+
return this.add(this.clock);
|
68
|
+
},
|
69
|
+
|
70
|
+
serverPrototype: sinon.fakeServer,
|
71
|
+
|
72
|
+
useFakeServer: function useFakeServer() {
|
73
|
+
var proto = this.serverPrototype || sinon.fakeServer;
|
74
|
+
|
75
|
+
if (!proto || !proto.create) {
|
76
|
+
return null;
|
77
|
+
}
|
78
|
+
|
79
|
+
this.server = proto.create();
|
80
|
+
return this.add(this.server);
|
81
|
+
},
|
82
|
+
|
83
|
+
inject: function (obj) {
|
84
|
+
sinon.collection.inject.call(this, obj);
|
85
|
+
|
86
|
+
if (this.clock) {
|
87
|
+
obj.clock = this.clock;
|
88
|
+
}
|
89
|
+
|
90
|
+
if (this.server) {
|
91
|
+
obj.server = this.server;
|
92
|
+
obj.requests = this.server.requests;
|
93
|
+
}
|
94
|
+
|
95
|
+
return obj;
|
96
|
+
},
|
97
|
+
|
98
|
+
restore: function () {
|
99
|
+
sinon.collection.restore.apply(this, arguments);
|
100
|
+
this.restoreContext();
|
101
|
+
},
|
102
|
+
|
103
|
+
restoreContext: function () {
|
104
|
+
if (this.injectedKeys) {
|
105
|
+
for (var i = 0, j = this.injectedKeys.length; i < j; i++) {
|
106
|
+
delete this.injectInto[this.injectedKeys[i]];
|
107
|
+
}
|
108
|
+
this.injectedKeys = [];
|
109
|
+
}
|
110
|
+
},
|
111
|
+
|
112
|
+
create: function (config) {
|
113
|
+
if (!config) {
|
114
|
+
return sinon.create(sinon.sandbox);
|
115
|
+
}
|
116
|
+
|
117
|
+
var sandbox = prepareSandboxFromConfig(config);
|
118
|
+
sandbox.args = sandbox.args || [];
|
119
|
+
sandbox.injectedKeys = [];
|
120
|
+
sandbox.injectInto = config.injectInto;
|
121
|
+
var prop, value, exposed = sandbox.inject({});
|
122
|
+
|
123
|
+
if (config.properties) {
|
124
|
+
for (var i = 0, l = config.properties.length; i < l; i++) {
|
125
|
+
prop = config.properties[i];
|
126
|
+
value = exposed[prop] || prop == "sandbox" && sandbox;
|
127
|
+
exposeValue(sandbox, config, prop, value);
|
128
|
+
}
|
129
|
+
} else {
|
130
|
+
exposeValue(sandbox, config, "sandbox", value);
|
131
|
+
}
|
132
|
+
|
133
|
+
return sandbox;
|
134
|
+
}
|
135
|
+
});
|
136
|
+
|
137
|
+
sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
|
138
|
+
|
139
|
+
if (typeof define === "function" && define.amd) {
|
140
|
+
define(["module"], function(module) { module.exports = sinon.sandbox; });
|
141
|
+
} else if (typeof module !== 'undefined' && module.exports) {
|
142
|
+
module.exports = sinon.sandbox;
|
143
|
+
}
|
144
|
+
}());
|
@@ -0,0 +1,413 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
* @depend call.js
|
4
|
+
*/
|
5
|
+
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
|
6
|
+
/*global module, require, sinon*/
|
7
|
+
/**
|
8
|
+
* Spy functions
|
9
|
+
*
|
10
|
+
* @author Christian Johansen (christian@cjohansen.no)
|
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
|
+
var push = Array.prototype.push;
|
20
|
+
var slice = Array.prototype.slice;
|
21
|
+
var callId = 0;
|
22
|
+
|
23
|
+
if (!sinon && commonJSModule) {
|
24
|
+
sinon = require("../sinon");
|
25
|
+
}
|
26
|
+
|
27
|
+
if (!sinon) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
function spy(object, property) {
|
32
|
+
if (!property && typeof object == "function") {
|
33
|
+
return spy.create(object);
|
34
|
+
}
|
35
|
+
|
36
|
+
if (!object && !property) {
|
37
|
+
return spy.create(function () { });
|
38
|
+
}
|
39
|
+
|
40
|
+
var method = object[property];
|
41
|
+
return sinon.wrapMethod(object, property, spy.create(method));
|
42
|
+
}
|
43
|
+
|
44
|
+
function matchingFake(fakes, args, strict) {
|
45
|
+
if (!fakes) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
49
|
+
for (var i = 0, l = fakes.length; i < l; i++) {
|
50
|
+
if (fakes[i].matches(args, strict)) {
|
51
|
+
return fakes[i];
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
function incrementCallCount() {
|
57
|
+
this.called = true;
|
58
|
+
this.callCount += 1;
|
59
|
+
this.notCalled = false;
|
60
|
+
this.calledOnce = this.callCount == 1;
|
61
|
+
this.calledTwice = this.callCount == 2;
|
62
|
+
this.calledThrice = this.callCount == 3;
|
63
|
+
}
|
64
|
+
|
65
|
+
function createCallProperties() {
|
66
|
+
this.firstCall = this.getCall(0);
|
67
|
+
this.secondCall = this.getCall(1);
|
68
|
+
this.thirdCall = this.getCall(2);
|
69
|
+
this.lastCall = this.getCall(this.callCount - 1);
|
70
|
+
}
|
71
|
+
|
72
|
+
var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
|
73
|
+
function createProxy(func) {
|
74
|
+
// Retain the function length:
|
75
|
+
var p;
|
76
|
+
if (func.length) {
|
77
|
+
eval("p = (function proxy(" + vars.substring(0, func.length * 2 - 1) +
|
78
|
+
") { return p.invoke(func, this, slice.call(arguments)); });");
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
p = function proxy() {
|
82
|
+
return p.invoke(func, this, slice.call(arguments));
|
83
|
+
};
|
84
|
+
}
|
85
|
+
return p;
|
86
|
+
}
|
87
|
+
|
88
|
+
var uuid = 0;
|
89
|
+
|
90
|
+
// Public API
|
91
|
+
var spyApi = {
|
92
|
+
reset: function () {
|
93
|
+
this.called = false;
|
94
|
+
this.notCalled = true;
|
95
|
+
this.calledOnce = false;
|
96
|
+
this.calledTwice = false;
|
97
|
+
this.calledThrice = false;
|
98
|
+
this.callCount = 0;
|
99
|
+
this.firstCall = null;
|
100
|
+
this.secondCall = null;
|
101
|
+
this.thirdCall = null;
|
102
|
+
this.lastCall = null;
|
103
|
+
this.args = [];
|
104
|
+
this.returnValues = [];
|
105
|
+
this.thisValues = [];
|
106
|
+
this.exceptions = [];
|
107
|
+
this.callIds = [];
|
108
|
+
if (this.fakes) {
|
109
|
+
for (var i = 0; i < this.fakes.length; i++) {
|
110
|
+
this.fakes[i].reset();
|
111
|
+
}
|
112
|
+
}
|
113
|
+
},
|
114
|
+
|
115
|
+
create: function create(func) {
|
116
|
+
var name;
|
117
|
+
|
118
|
+
if (typeof func != "function") {
|
119
|
+
func = function () { };
|
120
|
+
} else {
|
121
|
+
name = sinon.functionName(func);
|
122
|
+
}
|
123
|
+
|
124
|
+
var proxy = createProxy(func);
|
125
|
+
|
126
|
+
sinon.extend(proxy, spy);
|
127
|
+
delete proxy.create;
|
128
|
+
sinon.extend(proxy, func);
|
129
|
+
|
130
|
+
proxy.reset();
|
131
|
+
proxy.prototype = func.prototype;
|
132
|
+
proxy.displayName = name || "spy";
|
133
|
+
proxy.toString = sinon.functionToString;
|
134
|
+
proxy._create = sinon.spy.create;
|
135
|
+
proxy.id = "spy#" + uuid++;
|
136
|
+
|
137
|
+
return proxy;
|
138
|
+
},
|
139
|
+
|
140
|
+
invoke: function invoke(func, thisValue, args) {
|
141
|
+
var matching = matchingFake(this.fakes, args);
|
142
|
+
var exception, returnValue;
|
143
|
+
|
144
|
+
incrementCallCount.call(this);
|
145
|
+
push.call(this.thisValues, thisValue);
|
146
|
+
push.call(this.args, args);
|
147
|
+
push.call(this.callIds, callId++);
|
148
|
+
|
149
|
+
createCallProperties.call(this);
|
150
|
+
|
151
|
+
try {
|
152
|
+
if (matching) {
|
153
|
+
returnValue = matching.invoke(func, thisValue, args);
|
154
|
+
} else {
|
155
|
+
returnValue = (this.func || func).apply(thisValue, args);
|
156
|
+
}
|
157
|
+
|
158
|
+
var thisCall = this.getCall(this.callCount - 1);
|
159
|
+
if (thisCall.calledWithNew() && typeof returnValue !== 'object') {
|
160
|
+
returnValue = thisValue;
|
161
|
+
}
|
162
|
+
} catch (e) {
|
163
|
+
exception = e;
|
164
|
+
}
|
165
|
+
|
166
|
+
push.call(this.exceptions, exception);
|
167
|
+
push.call(this.returnValues, returnValue);
|
168
|
+
|
169
|
+
if (exception !== undefined) {
|
170
|
+
throw exception;
|
171
|
+
}
|
172
|
+
|
173
|
+
return returnValue;
|
174
|
+
},
|
175
|
+
|
176
|
+
named: function named(name) {
|
177
|
+
this.displayName = name;
|
178
|
+
return this;
|
179
|
+
},
|
180
|
+
|
181
|
+
getCall: function getCall(i) {
|
182
|
+
if (i < 0 || i >= this.callCount) {
|
183
|
+
return null;
|
184
|
+
}
|
185
|
+
|
186
|
+
return sinon.spyCall(this, this.thisValues[i], this.args[i],
|
187
|
+
this.returnValues[i], this.exceptions[i],
|
188
|
+
this.callIds[i]);
|
189
|
+
},
|
190
|
+
|
191
|
+
getCalls: function () {
|
192
|
+
var calls = [];
|
193
|
+
var i;
|
194
|
+
|
195
|
+
for (i = 0; i < this.callCount; i++) {
|
196
|
+
calls.push(this.getCall(i));
|
197
|
+
}
|
198
|
+
|
199
|
+
return calls;
|
200
|
+
},
|
201
|
+
|
202
|
+
calledBefore: function calledBefore(spyFn) {
|
203
|
+
if (!this.called) {
|
204
|
+
return false;
|
205
|
+
}
|
206
|
+
|
207
|
+
if (!spyFn.called) {
|
208
|
+
return true;
|
209
|
+
}
|
210
|
+
|
211
|
+
return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
|
212
|
+
},
|
213
|
+
|
214
|
+
calledAfter: function calledAfter(spyFn) {
|
215
|
+
if (!this.called || !spyFn.called) {
|
216
|
+
return false;
|
217
|
+
}
|
218
|
+
|
219
|
+
return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
|
220
|
+
},
|
221
|
+
|
222
|
+
withArgs: function () {
|
223
|
+
var args = slice.call(arguments);
|
224
|
+
|
225
|
+
if (this.fakes) {
|
226
|
+
var match = matchingFake(this.fakes, args, true);
|
227
|
+
|
228
|
+
if (match) {
|
229
|
+
return match;
|
230
|
+
}
|
231
|
+
} else {
|
232
|
+
this.fakes = [];
|
233
|
+
}
|
234
|
+
|
235
|
+
var original = this;
|
236
|
+
var fake = this._create();
|
237
|
+
fake.matchingAguments = args;
|
238
|
+
fake.parent = this;
|
239
|
+
push.call(this.fakes, fake);
|
240
|
+
|
241
|
+
fake.withArgs = function () {
|
242
|
+
return original.withArgs.apply(original, arguments);
|
243
|
+
};
|
244
|
+
|
245
|
+
for (var i = 0; i < this.args.length; i++) {
|
246
|
+
if (fake.matches(this.args[i])) {
|
247
|
+
incrementCallCount.call(fake);
|
248
|
+
push.call(fake.thisValues, this.thisValues[i]);
|
249
|
+
push.call(fake.args, this.args[i]);
|
250
|
+
push.call(fake.returnValues, this.returnValues[i]);
|
251
|
+
push.call(fake.exceptions, this.exceptions[i]);
|
252
|
+
push.call(fake.callIds, this.callIds[i]);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
createCallProperties.call(fake);
|
256
|
+
|
257
|
+
return fake;
|
258
|
+
},
|
259
|
+
|
260
|
+
matches: function (args, strict) {
|
261
|
+
var margs = this.matchingAguments;
|
262
|
+
|
263
|
+
if (margs.length <= args.length &&
|
264
|
+
sinon.deepEqual(margs, args.slice(0, margs.length))) {
|
265
|
+
return !strict || margs.length == args.length;
|
266
|
+
}
|
267
|
+
},
|
268
|
+
|
269
|
+
printf: function (format) {
|
270
|
+
var spy = this;
|
271
|
+
var args = slice.call(arguments, 1);
|
272
|
+
var formatter;
|
273
|
+
|
274
|
+
return (format || "").replace(/%(.)/g, function (match, specifyer) {
|
275
|
+
formatter = spyApi.formatters[specifyer];
|
276
|
+
|
277
|
+
if (typeof formatter == "function") {
|
278
|
+
return formatter.call(null, spy, args);
|
279
|
+
} else if (!isNaN(parseInt(specifyer, 10))) {
|
280
|
+
return sinon.format(args[specifyer - 1]);
|
281
|
+
}
|
282
|
+
|
283
|
+
return "%" + specifyer;
|
284
|
+
});
|
285
|
+
}
|
286
|
+
};
|
287
|
+
|
288
|
+
function delegateToCalls(method, matchAny, actual, notCalled) {
|
289
|
+
spyApi[method] = function () {
|
290
|
+
if (!this.called) {
|
291
|
+
if (notCalled) {
|
292
|
+
return notCalled.apply(this, arguments);
|
293
|
+
}
|
294
|
+
return false;
|
295
|
+
}
|
296
|
+
|
297
|
+
var currentCall;
|
298
|
+
var matches = 0;
|
299
|
+
|
300
|
+
for (var i = 0, l = this.callCount; i < l; i += 1) {
|
301
|
+
currentCall = this.getCall(i);
|
302
|
+
|
303
|
+
if (currentCall[actual || method].apply(currentCall, arguments)) {
|
304
|
+
matches += 1;
|
305
|
+
|
306
|
+
if (matchAny) {
|
307
|
+
return true;
|
308
|
+
}
|
309
|
+
}
|
310
|
+
}
|
311
|
+
|
312
|
+
return matches === this.callCount;
|
313
|
+
};
|
314
|
+
}
|
315
|
+
|
316
|
+
delegateToCalls("calledOn", true);
|
317
|
+
delegateToCalls("alwaysCalledOn", false, "calledOn");
|
318
|
+
delegateToCalls("calledWith", true);
|
319
|
+
delegateToCalls("calledWithMatch", true);
|
320
|
+
delegateToCalls("alwaysCalledWith", false, "calledWith");
|
321
|
+
delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
|
322
|
+
delegateToCalls("calledWithExactly", true);
|
323
|
+
delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
|
324
|
+
delegateToCalls("neverCalledWith", false, "notCalledWith",
|
325
|
+
function () { return true; });
|
326
|
+
delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch",
|
327
|
+
function () { return true; });
|
328
|
+
delegateToCalls("threw", true);
|
329
|
+
delegateToCalls("alwaysThrew", false, "threw");
|
330
|
+
delegateToCalls("returned", true);
|
331
|
+
delegateToCalls("alwaysReturned", false, "returned");
|
332
|
+
delegateToCalls("calledWithNew", true);
|
333
|
+
delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
|
334
|
+
delegateToCalls("callArg", false, "callArgWith", function () {
|
335
|
+
throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
|
336
|
+
});
|
337
|
+
spyApi.callArgWith = spyApi.callArg;
|
338
|
+
delegateToCalls("callArgOn", false, "callArgOnWith", function () {
|
339
|
+
throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
|
340
|
+
});
|
341
|
+
spyApi.callArgOnWith = spyApi.callArgOn;
|
342
|
+
delegateToCalls("yield", false, "yield", function () {
|
343
|
+
throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
|
344
|
+
});
|
345
|
+
// "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
|
346
|
+
spyApi.invokeCallback = spyApi.yield;
|
347
|
+
delegateToCalls("yieldOn", false, "yieldOn", function () {
|
348
|
+
throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
|
349
|
+
});
|
350
|
+
delegateToCalls("yieldTo", false, "yieldTo", function (property) {
|
351
|
+
throw new Error(this.toString() + " cannot yield to '" + property +
|
352
|
+
"' since it was not yet invoked.");
|
353
|
+
});
|
354
|
+
delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
|
355
|
+
throw new Error(this.toString() + " cannot yield to '" + property +
|
356
|
+
"' since it was not yet invoked.");
|
357
|
+
});
|
358
|
+
|
359
|
+
spyApi.formatters = {
|
360
|
+
"c": function (spy) {
|
361
|
+
return sinon.timesInWords(spy.callCount);
|
362
|
+
},
|
363
|
+
|
364
|
+
"n": function (spy) {
|
365
|
+
return spy.toString();
|
366
|
+
},
|
367
|
+
|
368
|
+
"C": function (spy) {
|
369
|
+
var calls = [];
|
370
|
+
|
371
|
+
for (var i = 0, l = spy.callCount; i < l; ++i) {
|
372
|
+
var stringifiedCall = " " + spy.getCall(i).toString();
|
373
|
+
if (/\n/.test(calls[i - 1])) {
|
374
|
+
stringifiedCall = "\n" + stringifiedCall;
|
375
|
+
}
|
376
|
+
push.call(calls, stringifiedCall);
|
377
|
+
}
|
378
|
+
|
379
|
+
return calls.length > 0 ? "\n" + calls.join("\n") : "";
|
380
|
+
},
|
381
|
+
|
382
|
+
"t": function (spy) {
|
383
|
+
var objects = [];
|
384
|
+
|
385
|
+
for (var i = 0, l = spy.callCount; i < l; ++i) {
|
386
|
+
push.call(objects, sinon.format(spy.thisValues[i]));
|
387
|
+
}
|
388
|
+
|
389
|
+
return objects.join(", ");
|
390
|
+
},
|
391
|
+
|
392
|
+
"*": function (spy, args) {
|
393
|
+
var formatted = [];
|
394
|
+
|
395
|
+
for (var i = 0, l = args.length; i < l; ++i) {
|
396
|
+
push.call(formatted, sinon.format(args[i]));
|
397
|
+
}
|
398
|
+
|
399
|
+
return formatted.join(", ");
|
400
|
+
}
|
401
|
+
};
|
402
|
+
|
403
|
+
sinon.extend(spy, spyApi);
|
404
|
+
|
405
|
+
spy.spyCall = sinon.spyCall;
|
406
|
+
sinon.spy = spy;
|
407
|
+
|
408
|
+
if (typeof define === "function" && define.amd) {
|
409
|
+
define(["module"], function(module) { module.exports = spy; });
|
410
|
+
} else if (commonJSModule) {
|
411
|
+
module.exports = spy;
|
412
|
+
}
|
413
|
+
}(typeof sinon == "object" && sinon || null));
|
@@ -0,0 +1,161 @@
|
|
1
|
+
/**
|
2
|
+
* @depend ../sinon.js
|
3
|
+
* @depend spy.js
|
4
|
+
* @depend behavior.js
|
5
|
+
*/
|
6
|
+
/*jslint eqeqeq: false, onevar: false*/
|
7
|
+
/*global module, require, sinon*/
|
8
|
+
/**
|
9
|
+
* Stub functions
|
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
|
+
|
21
|
+
if (!sinon && commonJSModule) {
|
22
|
+
sinon = require("../sinon");
|
23
|
+
}
|
24
|
+
|
25
|
+
if (!sinon) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
|
29
|
+
function stub(object, property, func) {
|
30
|
+
if (!!func && typeof func != "function") {
|
31
|
+
throw new TypeError("Custom stub should be function");
|
32
|
+
}
|
33
|
+
|
34
|
+
var wrapper;
|
35
|
+
|
36
|
+
if (func) {
|
37
|
+
wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
|
38
|
+
} else {
|
39
|
+
wrapper = stub.create();
|
40
|
+
}
|
41
|
+
|
42
|
+
if (!object && typeof property === "undefined") {
|
43
|
+
return sinon.stub.create();
|
44
|
+
}
|
45
|
+
|
46
|
+
if (typeof property === "undefined" && typeof object == "object") {
|
47
|
+
for (var prop in object) {
|
48
|
+
if (typeof object[prop] === "function") {
|
49
|
+
stub(object, prop);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
return object;
|
54
|
+
}
|
55
|
+
|
56
|
+
return sinon.wrapMethod(object, property, wrapper);
|
57
|
+
}
|
58
|
+
|
59
|
+
function getDefaultBehavior(stub) {
|
60
|
+
return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
|
61
|
+
}
|
62
|
+
|
63
|
+
function getParentBehaviour(stub) {
|
64
|
+
return (stub.parent && getCurrentBehavior(stub.parent));
|
65
|
+
}
|
66
|
+
|
67
|
+
function getCurrentBehavior(stub) {
|
68
|
+
var behavior = stub.behaviors[stub.callCount - 1];
|
69
|
+
return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
|
70
|
+
}
|
71
|
+
|
72
|
+
var uuid = 0;
|
73
|
+
|
74
|
+
sinon.extend(stub, (function () {
|
75
|
+
var proto = {
|
76
|
+
create: function create() {
|
77
|
+
var functionStub = function () {
|
78
|
+
return getCurrentBehavior(functionStub).invoke(this, arguments);
|
79
|
+
};
|
80
|
+
|
81
|
+
functionStub.id = "stub#" + uuid++;
|
82
|
+
var orig = functionStub;
|
83
|
+
functionStub = sinon.spy.create(functionStub);
|
84
|
+
functionStub.func = orig;
|
85
|
+
|
86
|
+
sinon.extend(functionStub, stub);
|
87
|
+
functionStub._create = sinon.stub.create;
|
88
|
+
functionStub.displayName = "stub";
|
89
|
+
functionStub.toString = sinon.functionToString;
|
90
|
+
|
91
|
+
functionStub.defaultBehavior = null;
|
92
|
+
functionStub.behaviors = [];
|
93
|
+
|
94
|
+
return functionStub;
|
95
|
+
},
|
96
|
+
|
97
|
+
resetBehavior: function () {
|
98
|
+
var i;
|
99
|
+
|
100
|
+
this.defaultBehavior = null;
|
101
|
+
this.behaviors = [];
|
102
|
+
|
103
|
+
delete this.returnValue;
|
104
|
+
delete this.returnArgAt;
|
105
|
+
this.returnThis = false;
|
106
|
+
|
107
|
+
if (this.fakes) {
|
108
|
+
for (i = 0; i < this.fakes.length; i++) {
|
109
|
+
this.fakes[i].resetBehavior();
|
110
|
+
}
|
111
|
+
}
|
112
|
+
},
|
113
|
+
|
114
|
+
onCall: function(index) {
|
115
|
+
if (!this.behaviors[index]) {
|
116
|
+
this.behaviors[index] = sinon.behavior.create(this);
|
117
|
+
}
|
118
|
+
|
119
|
+
return this.behaviors[index];
|
120
|
+
},
|
121
|
+
|
122
|
+
onFirstCall: function() {
|
123
|
+
return this.onCall(0);
|
124
|
+
},
|
125
|
+
|
126
|
+
onSecondCall: function() {
|
127
|
+
return this.onCall(1);
|
128
|
+
},
|
129
|
+
|
130
|
+
onThirdCall: function() {
|
131
|
+
return this.onCall(2);
|
132
|
+
}
|
133
|
+
};
|
134
|
+
|
135
|
+
for (var method in sinon.behavior) {
|
136
|
+
if (sinon.behavior.hasOwnProperty(method) &&
|
137
|
+
!proto.hasOwnProperty(method) &&
|
138
|
+
method != 'create' &&
|
139
|
+
method != 'withArgs' &&
|
140
|
+
method != 'invoke') {
|
141
|
+
proto[method] = (function(behaviorMethod) {
|
142
|
+
return function() {
|
143
|
+
this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
|
144
|
+
this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
|
145
|
+
return this;
|
146
|
+
};
|
147
|
+
}(method));
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
return proto;
|
152
|
+
}()));
|
153
|
+
|
154
|
+
sinon.stub = stub;
|
155
|
+
|
156
|
+
if (typeof define === "function" && define.amd) {
|
157
|
+
define(["module"], function(module) { module.exports = stub; });
|
158
|
+
} else if (commonJSModule) {
|
159
|
+
module.exports = stub;
|
160
|
+
}
|
161
|
+
}(typeof sinon == "object" && sinon || null));
|