ende 0.5.20 → 0.5.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/component.json +1 -1
  3. data/components/indefinido/indemma/master/.gitignore +17 -0
  4. data/components/indefinido/indemma/master/.ruby-gemset +1 -0
  5. data/components/indefinido/indemma/master/.ruby-version +1 -0
  6. data/components/indefinido/indemma/master/Gemfile +12 -0
  7. data/components/indefinido/indemma/master/Guardfile +39 -0
  8. data/components/indefinido/indemma/master/History.md +0 -0
  9. data/components/indefinido/indemma/master/Readme.md +445 -0
  10. data/components/indefinido/indemma/master/build/development.js +26123 -0
  11. data/components/indefinido/indemma/master/build/release.js +16741 -0
  12. data/components/indefinido/indemma/master/build/test.js +26123 -0
  13. data/components/indefinido/indemma/master/component.json +1 -1
  14. data/components/indefinido/indemma/master/components/chaijs/assertion-error/1.0.0/component.json +18 -0
  15. data/components/indefinido/indemma/master/components/chaijs/assertion-error/1.0.0/index.js +110 -0
  16. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.gitignore +22 -0
  17. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.mailmap +1 -0
  18. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.npmignore +14 -0
  19. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/.travis.yml +14 -0
  20. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/CONTRIBUTING.md +173 -0
  21. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/History.md +895 -0
  22. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/Makefile +93 -0
  23. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/README.md +99 -0
  24. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/ReleaseNotes.md +482 -0
  25. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/bower.json +27 -0
  26. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/chai.js +4782 -0
  27. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/component.json +50 -0
  28. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/index.js +1 -0
  29. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/karma.conf.js +28 -0
  30. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/karma.sauce.js +41 -0
  31. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/assertion.js +130 -0
  32. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/config.js +50 -0
  33. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +1314 -0
  34. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +1056 -0
  35. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +12 -0
  36. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +78 -0
  37. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +111 -0
  38. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +43 -0
  39. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +40 -0
  40. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +32 -0
  41. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +18 -0
  42. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +25 -0
  43. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +49 -0
  44. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +20 -0
  45. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +102 -0
  46. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +35 -0
  47. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +114 -0
  48. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +320 -0
  49. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +49 -0
  50. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +53 -0
  51. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +51 -0
  52. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +54 -0
  53. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +26 -0
  54. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +44 -0
  55. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +45 -0
  56. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai.js +87 -0
  57. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/package.json +42 -0
  58. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/sauce.browsers.js +128 -0
  59. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +7 -0
  60. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +53 -0
  61. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/assert.js +638 -0
  62. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
  63. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/bootstrap/index.js +22 -0
  64. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +22 -0
  65. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/configuration.js +133 -0
  66. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/display/errors.js +14 -0
  67. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/display/message.js +47 -0
  68. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/expect.js +814 -0
  69. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/globalShould.js +15 -0
  70. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/plugins.js +24 -0
  71. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/should.js +744 -0
  72. data/components/indefinido/indemma/master/components/chaijs/chai/1.9.1/test/utilities.js +309 -0
  73. data/components/indefinido/indemma/master/components/chaijs/deep-eql/0.1.3/component.json +20 -0
  74. data/components/indefinido/indemma/master/components/chaijs/deep-eql/0.1.3/lib/eql.js +257 -0
  75. data/components/indefinido/indemma/master/components/chaijs/type-detect/0.1.1/component.json +18 -0
  76. data/components/indefinido/indemma/master/components/chaijs/type-detect/0.1.1/lib/type.js +142 -0
  77. data/components/indefinido/indemma/master/components/component/bind/1.0.0/component.json +14 -0
  78. data/components/indefinido/indemma/master/components/component/bind/1.0.0/index.js +23 -0
  79. data/components/indefinido/indemma/master/components/component/jquery/1.0.0/component.json +10 -0
  80. data/components/indefinido/indemma/master/components/component/jquery/1.0.0/index.js +10308 -0
  81. data/components/indefinido/indemma/master/components/component/type/1.0.0/component.json +20 -0
  82. data/components/indefinido/indemma/master/components/component/type/1.0.0/index.js +32 -0
  83. data/components/indefinido/indemma/master/components/indefinido/advisable/master/component.json +21 -0
  84. data/components/indefinido/indemma/master/components/indefinido/advisable/master/index.js +1 -0
  85. data/components/indefinido/indemma/master/components/indefinido/advisable/master/lib/advisable.js +60 -0
  86. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/component.json +39 -0
  87. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/index.js +1 -0
  88. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/adapters/rivets.js +40 -0
  89. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/legacy/notifierable.js +145 -0
  90. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +147 -0
  91. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/lookup.js +38 -0
  92. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/keypath_observer.js +38 -0
  93. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/observation.js +45 -0
  94. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/selection.js +57 -0
  95. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable/self_observer.js +38 -0
  96. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/observable.js +97 -0
  97. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/lib/platform.js +12 -0
  98. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/observe-js/observe.js +1631 -0
  99. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/accessors-legacy.js +92 -0
  100. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/accessors.js +248 -0
  101. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/array.indexOf.js +8 -0
  102. data/components/indefinido/indemma/master/components/indefinido/observable/es6-modules/vendor/shims/object.create.js +77 -0
  103. data/components/indefinido/indemma/master/components/pluma/assimilate/0.4.0/component.json +25 -0
  104. data/components/indefinido/indemma/master/components/pluma/assimilate/0.4.0/dist/assimilate.js +127 -0
  105. data/components/indefinido/indemma/master/karma.conf.js +75 -0
  106. data/components/indefinido/indemma/master/lib/record/associable.js +4 -2
  107. data/components/indefinido/indemma/master/lib/record/dirtyable.js +1 -1
  108. data/components/indefinido/indemma/master/package.json +9 -0
  109. data/components/indefinido/indemma/master/spec/record/associable_spec.js +211 -0
  110. data/components/indefinido/indemma/master/spec/record/dirtyable_spec.js +57 -0
  111. data/components/indefinido/indemma/master/spec/record/maid_spec.js +40 -0
  112. data/components/indefinido/indemma/master/spec/record/persistable_spec.js +46 -0
  113. data/components/indefinido/indemma/master/spec/record/queryable_spec.js +39 -0
  114. data/components/indefinido/indemma/master/spec/record/resource_spec.js +93 -0
  115. data/components/indefinido/indemma/master/spec/record/rest_spec.js +32 -0
  116. data/components/indefinido/indemma/master/spec/record/restfulable_spec.js +346 -0
  117. data/components/indefinido/indemma/master/spec/record/scopable_spec.js +242 -0
  118. data/components/indefinido/indemma/master/spec/record/storable_spec.js +44 -0
  119. data/components/indefinido/indemma/master/spec/record/translationable.js +28 -0
  120. data/components/indefinido/indemma/master/spec/record/validatable_spec.js +142 -0
  121. data/components/indefinido/indemma/master/spec/record/validations/associated_spec.js +43 -0
  122. data/components/indefinido/indemma/master/spec/record/validations/confirmation_spec.js +36 -0
  123. data/components/indefinido/indemma/master/spec/record/validations/cpf_spec.js +34 -0
  124. data/components/indefinido/indemma/master/spec/record/validations/presence_spec.js +28 -0
  125. data/components/indefinido/indemma/master/spec/record/validations/remote_spec.js +87 -0
  126. data/components/indefinido/indemma/master/spec/record/validations/type_spec.js +48 -0
  127. data/components/indefinido/indemma/master/spec/record_spec.js +49 -0
  128. data/components/indefinido/indemma/master/spec/spec_helper.js +15 -0
  129. data/components/indefinido/indemma/master/spec/support/value_objects/phone.js +45 -0
  130. data/components/indefinido/indemma/master/src/lib/extensions/rivets.coffee +17 -0
  131. data/components/indefinido/indemma/master/src/lib/record/associable.coffee +419 -0
  132. data/components/indefinido/indemma/master/src/lib/record/dirtyable.coffee +47 -0
  133. data/components/indefinido/indemma/master/src/lib/record/errors.coffee +20 -0
  134. data/components/indefinido/indemma/master/src/lib/record/maid.coffee +16 -0
  135. data/components/indefinido/indemma/master/src/lib/record/persistable.coffee +34 -0
  136. data/components/indefinido/indemma/master/src/lib/record/queryable.coffee +29 -0
  137. data/components/indefinido/indemma/master/src/lib/record/resource.coffee +107 -0
  138. data/components/indefinido/indemma/master/src/lib/record/rest.coffee +34 -0
  139. data/components/indefinido/indemma/master/src/lib/record/restfulable.coffee +487 -0
  140. data/components/indefinido/indemma/master/src/lib/record/scopable.coffee +279 -0
  141. data/components/indefinido/indemma/master/src/lib/record/storable.coffee +49 -0
  142. data/components/indefinido/indemma/master/src/lib/record/translationable.coffee +18 -0
  143. data/components/indefinido/indemma/master/src/lib/record/validatable.coffee +241 -0
  144. data/components/indefinido/indemma/master/src/lib/record/validations/associated.coffee +34 -0
  145. data/components/indefinido/indemma/master/src/lib/record/validations/confirmation.coffee +17 -0
  146. data/components/indefinido/indemma/master/src/lib/record/validations/cpf.coffee +57 -0
  147. data/components/indefinido/indemma/master/src/lib/record/validations/presence.coffee +16 -0
  148. data/components/indefinido/indemma/master/src/lib/record/validations/remote.coffee +61 -0
  149. data/components/indefinido/indemma/master/src/lib/record/validations/type.coffee +31 -0
  150. data/components/indefinido/indemma/master/src/lib/record/validations/validatorable.coffee +5 -0
  151. data/components/indefinido/indemma/master/src/lib/record.coffee +143 -0
  152. data/components/indefinido/indemma/master/src/spec/record/associable_spec.coffee +205 -0
  153. data/components/indefinido/indemma/master/src/spec/record/dirtyable_spec.coffee +47 -0
  154. data/components/indefinido/indemma/master/src/spec/record/maid_spec.coffee +34 -0
  155. data/components/indefinido/indemma/master/src/spec/record/persistable_spec.coffee +39 -0
  156. data/components/indefinido/indemma/master/src/spec/record/queryable_spec.coffee +33 -0
  157. data/components/indefinido/indemma/master/src/spec/record/resource_spec.coffee +69 -0
  158. data/components/indefinido/indemma/master/src/spec/record/rest_spec.coffee +22 -0
  159. data/components/indefinido/indemma/master/src/spec/record/restfulable_spec.coffee +257 -0
  160. data/components/indefinido/indemma/master/src/spec/record/scopable_spec.coffee +227 -0
  161. data/components/indefinido/indemma/master/src/spec/record/storable_spec.coffee +39 -0
  162. data/components/indefinido/indemma/master/src/spec/record/translationable.coffee +19 -0
  163. data/components/indefinido/indemma/master/src/spec/record/validatable_spec.coffee +127 -0
  164. data/components/indefinido/indemma/master/src/spec/record/validations/associated_spec.coffee +35 -0
  165. data/components/indefinido/indemma/master/src/spec/record/validations/confirmation_spec.coffee +25 -0
  166. data/components/indefinido/indemma/master/src/spec/record/validations/cpf_spec.coffee +27 -0
  167. data/components/indefinido/indemma/master/src/spec/record/validations/presence_spec.coffee +24 -0
  168. data/components/indefinido/indemma/master/src/spec/record/validations/remote_spec.coffee +74 -0
  169. data/components/indefinido/indemma/master/src/spec/record/validations/type_spec.coffee +33 -0
  170. data/components/indefinido/indemma/master/src/spec/record_spec.coffee +29 -0
  171. data/components/indefinido/indemma/master/src/spec/spec_helper.coffee +11 -0
  172. data/components/indefinido/indemma/master/src/spec/support/value_objects/phone.coffee +30 -0
  173. data/components/indefinido/indemma/master/vendor/object/mixin.js +196 -0
  174. data/components/indefinido/indemma/master/vendor/spec/sinon/assert.js +199 -0
  175. data/components/indefinido/indemma/master/vendor/spec/sinon/behavior.js +334 -0
  176. data/components/indefinido/indemma/master/vendor/spec/sinon/call.js +205 -0
  177. data/components/indefinido/indemma/master/vendor/spec/sinon/collection.js +155 -0
  178. data/components/indefinido/indemma/master/vendor/spec/sinon/match.js +245 -0
  179. data/components/indefinido/indemma/master/vendor/spec/sinon/mock.js +451 -0
  180. data/components/indefinido/indemma/master/vendor/spec/sinon/sandbox.js +144 -0
  181. data/components/indefinido/indemma/master/vendor/spec/sinon/spy.js +413 -0
  182. data/components/indefinido/indemma/master/vendor/spec/sinon/stub.js +161 -0
  183. data/components/indefinido/indemma/master/vendor/spec/sinon/test.js +77 -0
  184. data/components/indefinido/indemma/master/vendor/spec/sinon/test_case.js +99 -0
  185. data/components/indefinido/indemma/master/vendor/spec/sinon/util/event.js +94 -0
  186. data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_server.js +212 -0
  187. data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_server_with_clock.js +83 -0
  188. data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_timers.js +405 -0
  189. data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_xdomain_request.js +206 -0
  190. data/components/indefinido/indemma/master/vendor/spec/sinon/util/fake_xml_http_request.js +575 -0
  191. data/components/indefinido/indemma/master/vendor/spec/sinon/util/timers_ie.js +31 -0
  192. data/components/indefinido/indemma/master/vendor/spec/sinon/util/xdr_ie.js +14 -0
  193. data/components/indefinido/indemma/master/vendor/spec/sinon/util/xhr_ie.js +19 -0
  194. data/components/indefinido/indemma/master/vendor/spec/sinon.js +383 -0
  195. data/lib/assets/javascripts/value_objects/phone.js.coffee +3 -1
  196. data/lib/assets/javascripts/widgets/viewer/plugins/scopable.js.coffee +5 -5
  197. data/lib/ende/version.rb +1 -1
  198. data/vendor/assets/components/ende_build.css +4 -4
  199. data/vendor/assets/components/ende_build.js +7974 -7889
  200. metadata +191 -5
  201. data/vendor/assets/component/build.css +0 -112
  202. data/vendor/assets/components/build.css +0 -112
  203. data/vendor/assets/components/indemma_with_none.js +0 -30553
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @depend ../sinon.js
3
+ * @depend stub.js
4
+ * @depend mock.js
5
+ * @depend sandbox.js
6
+ */
7
+ /*jslint eqeqeq: false, onevar: false, forin: true, plusplus: false*/
8
+ /*global module, require, sinon*/
9
+ /**
10
+ * Test function, sandboxes fakes
11
+ *
12
+ * @author Christian Johansen (christian@cjohansen.no)
13
+ * @license BSD
14
+ *
15
+ * Copyright (c) 2010-2013 Christian Johansen
16
+ */
17
+ "use strict";
18
+
19
+ (function (sinon) {
20
+ var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
21
+
22
+ if (!sinon && commonJSModule) {
23
+ sinon = require("../sinon");
24
+ }
25
+
26
+ if (!sinon) {
27
+ return;
28
+ }
29
+
30
+ function test(callback) {
31
+ var type = typeof callback;
32
+
33
+ if (type != "function") {
34
+ throw new TypeError("sinon.test needs to wrap a test function, got " + type);
35
+ }
36
+
37
+ return function () {
38
+ var config = sinon.getConfig(sinon.config);
39
+ config.injectInto = config.injectIntoThis && this || config.injectInto;
40
+ var sandbox = sinon.sandbox.create(config);
41
+ var exception, result;
42
+ var args = Array.prototype.slice.call(arguments).concat(sandbox.args);
43
+
44
+ try {
45
+ result = callback.apply(this, args);
46
+ } catch (e) {
47
+ exception = e;
48
+ }
49
+
50
+ if (typeof exception !== "undefined") {
51
+ sandbox.restore();
52
+ throw exception;
53
+ }
54
+ else {
55
+ sandbox.verifyAndRestore();
56
+ }
57
+
58
+ return result;
59
+ };
60
+ }
61
+
62
+ test.config = {
63
+ injectIntoThis: true,
64
+ injectInto: null,
65
+ properties: ["spy", "stub", "mock", "clock", "server", "requests"],
66
+ useFakeTimers: true,
67
+ useFakeServer: true
68
+ };
69
+
70
+ sinon.test = test;
71
+
72
+ if (typeof define === "function" && define.amd) {
73
+ define(["module"], function(module) { module.exports = test; });
74
+ } else if (commonJSModule) {
75
+ module.exports = test;
76
+ }
77
+ }(typeof sinon == "object" && sinon || null));
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @depend ../sinon.js
3
+ * @depend test.js
4
+ */
5
+ /*jslint eqeqeq: false, onevar: false, eqeqeq: false*/
6
+ /*global module, require, sinon*/
7
+ /**
8
+ * Test case, sandboxes all test 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
+
20
+ if (!sinon && commonJSModule) {
21
+ sinon = require("../sinon");
22
+ }
23
+
24
+ if (!sinon || !Object.prototype.hasOwnProperty) {
25
+ return;
26
+ }
27
+
28
+ function createTest(property, setUp, tearDown) {
29
+ return function () {
30
+ if (setUp) {
31
+ setUp.apply(this, arguments);
32
+ }
33
+
34
+ var exception, result;
35
+
36
+ try {
37
+ result = property.apply(this, arguments);
38
+ } catch (e) {
39
+ exception = e;
40
+ }
41
+
42
+ if (tearDown) {
43
+ tearDown.apply(this, arguments);
44
+ }
45
+
46
+ if (exception) {
47
+ throw exception;
48
+ }
49
+
50
+ return result;
51
+ };
52
+ }
53
+
54
+ function testCase(tests, prefix) {
55
+ /*jsl:ignore*/
56
+ if (!tests || typeof tests != "object") {
57
+ throw new TypeError("sinon.testCase needs an object with test functions");
58
+ }
59
+ /*jsl:end*/
60
+
61
+ prefix = prefix || "test";
62
+ var rPrefix = new RegExp("^" + prefix);
63
+ var methods = {}, testName, property, method;
64
+ var setUp = tests.setUp;
65
+ var tearDown = tests.tearDown;
66
+
67
+ for (testName in tests) {
68
+ if (tests.hasOwnProperty(testName)) {
69
+ property = tests[testName];
70
+
71
+ if (/^(setUp|tearDown)$/.test(testName)) {
72
+ continue;
73
+ }
74
+
75
+ if (typeof property == "function" && rPrefix.test(testName)) {
76
+ method = property;
77
+
78
+ if (setUp || tearDown) {
79
+ method = createTest(property, setUp, tearDown);
80
+ }
81
+
82
+ methods[testName] = sinon.test(method);
83
+ } else {
84
+ methods[testName] = tests[testName];
85
+ }
86
+ }
87
+ }
88
+
89
+ return methods;
90
+ }
91
+
92
+ sinon.testCase = testCase;
93
+
94
+ if (typeof define === "function" && define.amd) {
95
+ define(["module"], function(module) { module.exports = testCase; });
96
+ } else if (commonJSModule) {
97
+ module.exports = testCase;
98
+ }
99
+ }(typeof sinon == "object" && sinon || null));
@@ -0,0 +1,94 @@
1
+ /*jslint eqeqeq: false, onevar: false*/
2
+ /*global sinon, module, require, ActiveXObject, XMLHttpRequest, DOMParser*/
3
+ /**
4
+ * Minimal Event interface implementation
5
+ *
6
+ * Original implementation by Sven Fuchs: https://gist.github.com/995028
7
+ * Modifications and tests by Christian Johansen.
8
+ *
9
+ * @author Sven Fuchs (svenfuchs@artweb-design.de)
10
+ * @author Christian Johansen (christian@cjohansen.no)
11
+ * @license BSD
12
+ *
13
+ * Copyright (c) 2011 Sven Fuchs, Christian Johansen
14
+ */
15
+ "use strict";
16
+
17
+ if (typeof sinon == "undefined") {
18
+ this.sinon = {};
19
+ }
20
+
21
+ (function () {
22
+ var push = [].push;
23
+
24
+ sinon.Event = function Event(type, bubbles, cancelable, target) {
25
+ this.initEvent(type, bubbles, cancelable, target);
26
+ };
27
+
28
+ sinon.Event.prototype = {
29
+ initEvent: function(type, bubbles, cancelable, target) {
30
+ this.type = type;
31
+ this.bubbles = bubbles;
32
+ this.cancelable = cancelable;
33
+ this.target = target;
34
+ },
35
+
36
+ stopPropagation: function () {},
37
+
38
+ preventDefault: function () {
39
+ this.defaultPrevented = true;
40
+ }
41
+ };
42
+
43
+ sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) {
44
+ this.initEvent(type, false, false, target);
45
+ this.loaded = progressEventRaw.loaded || null;
46
+ this.total = progressEventRaw.total || null;
47
+ };
48
+
49
+ sinon.ProgressEvent.prototype = new sinon.Event();
50
+
51
+ sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent;
52
+
53
+ sinon.CustomEvent = function CustomEvent(type, customData, target) {
54
+ this.initEvent(type, false, false, target);
55
+ this.detail = customData.detail || null;
56
+ };
57
+
58
+ sinon.CustomEvent.prototype = new sinon.Event();
59
+
60
+ sinon.CustomEvent.prototype.constructor = sinon.CustomEvent;
61
+
62
+ sinon.EventTarget = {
63
+ addEventListener: function addEventListener(event, listener) {
64
+ this.eventListeners = this.eventListeners || {};
65
+ this.eventListeners[event] = this.eventListeners[event] || [];
66
+ push.call(this.eventListeners[event], listener);
67
+ },
68
+
69
+ removeEventListener: function removeEventListener(event, listener) {
70
+ var listeners = this.eventListeners && this.eventListeners[event] || [];
71
+
72
+ for (var i = 0, l = listeners.length; i < l; ++i) {
73
+ if (listeners[i] == listener) {
74
+ return listeners.splice(i, 1);
75
+ }
76
+ }
77
+ },
78
+
79
+ dispatchEvent: function dispatchEvent(event) {
80
+ var type = event.type;
81
+ var listeners = this.eventListeners && this.eventListeners[type] || [];
82
+
83
+ for (var i = 0; i < listeners.length; i++) {
84
+ if (typeof listeners[i] == "function") {
85
+ listeners[i].call(this, event);
86
+ } else {
87
+ listeners[i].handleEvent(event);
88
+ }
89
+ }
90
+
91
+ return !!event.defaultPrevented;
92
+ }
93
+ };
94
+ }());
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @depend fake_xml_http_request.js
3
+ */
4
+ /*jslint eqeqeq: false, onevar: false, regexp: false, plusplus: false*/
5
+ /*global module, require, window*/
6
+ /**
7
+ * The Sinon "server" mimics a web server that receives requests from
8
+ * sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
9
+ * both synchronously and asynchronously. To respond synchronuously, canned
10
+ * answers have to be provided upfront.
11
+ *
12
+ * @author Christian Johansen (christian@cjohansen.no)
13
+ * @license BSD
14
+ *
15
+ * Copyright (c) 2010-2013 Christian Johansen
16
+ */
17
+ "use strict";
18
+
19
+ if (typeof sinon == "undefined") {
20
+ var sinon = {};
21
+ }
22
+
23
+ sinon.fakeServer = (function () {
24
+ var push = [].push;
25
+ function F() {}
26
+
27
+ function create(proto) {
28
+ F.prototype = proto;
29
+ return new F();
30
+ }
31
+
32
+ function responseArray(handler) {
33
+ var response = handler;
34
+
35
+ if (Object.prototype.toString.call(handler) != "[object Array]") {
36
+ response = [200, {}, handler];
37
+ }
38
+
39
+ if (typeof response[2] != "string") {
40
+ throw new TypeError("Fake server response body should be string, but was " +
41
+ typeof response[2]);
42
+ }
43
+
44
+ return response;
45
+ }
46
+
47
+ var wloc = typeof window !== "undefined" ? window.location : {};
48
+ var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
49
+
50
+ function matchOne(response, reqMethod, reqUrl) {
51
+ var rmeth = response.method;
52
+ var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase();
53
+ var url = response.url;
54
+ var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl));
55
+
56
+ return matchMethod && matchUrl;
57
+ }
58
+
59
+ function match(response, request) {
60
+ var requestUrl = request.url;
61
+
62
+ if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
63
+ requestUrl = requestUrl.replace(rCurrLoc, "");
64
+ }
65
+
66
+ if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
67
+ if (typeof response.response == "function") {
68
+ var ru = response.url;
69
+ var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
70
+ return response.response.apply(response, args);
71
+ }
72
+
73
+ return true;
74
+ }
75
+
76
+ return false;
77
+ }
78
+
79
+ function log(response, request) {
80
+ var str;
81
+
82
+ str = "Request:\n" + sinon.format(request) + "\n\n";
83
+ str += "Response:\n" + sinon.format(response) + "\n\n";
84
+
85
+ sinon.log(str);
86
+ }
87
+
88
+ return {
89
+ create: function () {
90
+ var server = create(this);
91
+ this.xhr = sinon.useFakeXMLHttpRequest();
92
+ server.requests = [];
93
+
94
+ this.xhr.onCreate = function (xhrObj) {
95
+ server.addRequest(xhrObj);
96
+ };
97
+
98
+ return server;
99
+ },
100
+
101
+ addRequest: function addRequest(xhrObj) {
102
+ var server = this;
103
+ push.call(this.requests, xhrObj);
104
+
105
+ xhrObj.onSend = function () {
106
+ server.handleRequest(this);
107
+
108
+ if (server.autoRespond && !server.responding) {
109
+ setTimeout(function () {
110
+ server.responding = false;
111
+ server.respond();
112
+ }, server.autoRespondAfter || 10);
113
+
114
+ server.responding = true;
115
+ }
116
+ };
117
+ },
118
+
119
+ getHTTPMethod: function getHTTPMethod(request) {
120
+ if (this.fakeHTTPMethods && /post/i.test(request.method)) {
121
+ var matches = (request.requestBody || "").match(/_method=([^\b;]+)/);
122
+ return !!matches ? matches[1] : request.method;
123
+ }
124
+
125
+ return request.method;
126
+ },
127
+
128
+ handleRequest: function handleRequest(xhr) {
129
+ if (xhr.async) {
130
+ if (!this.queue) {
131
+ this.queue = [];
132
+ }
133
+
134
+ push.call(this.queue, xhr);
135
+ } else {
136
+ this.processRequest(xhr);
137
+ }
138
+ },
139
+
140
+ respondWith: function respondWith(method, url, body) {
141
+ if (arguments.length == 1 && typeof method != "function") {
142
+ this.response = responseArray(method);
143
+ return;
144
+ }
145
+
146
+ if (!this.responses) { this.responses = []; }
147
+
148
+ if (arguments.length == 1) {
149
+ body = method;
150
+ url = method = null;
151
+ }
152
+
153
+ if (arguments.length == 2) {
154
+ body = url;
155
+ url = method;
156
+ method = null;
157
+ }
158
+
159
+ push.call(this.responses, {
160
+ method: method,
161
+ url: url,
162
+ response: typeof body == "function" ? body : responseArray(body)
163
+ });
164
+ },
165
+
166
+ respond: function respond() {
167
+ if (arguments.length > 0) this.respondWith.apply(this, arguments);
168
+ var queue = this.queue || [];
169
+ var requests = queue.splice(0, queue.length);
170
+ var request;
171
+
172
+ while(request = requests.shift()) {
173
+ this.processRequest(request);
174
+ }
175
+ },
176
+
177
+ processRequest: function processRequest(request) {
178
+ try {
179
+ if (request.aborted) {
180
+ return;
181
+ }
182
+
183
+ var response = this.response || [404, {}, ""];
184
+
185
+ if (this.responses) {
186
+ for (var l = this.responses.length, i = l - 1; i >= 0; i--) {
187
+ if (match.call(this, this.responses[i], request)) {
188
+ response = this.responses[i].response;
189
+ break;
190
+ }
191
+ }
192
+ }
193
+
194
+ if (request.readyState != 4) {
195
+ log(response, request);
196
+
197
+ request.respond(response[0], response[1], response[2]);
198
+ }
199
+ } catch (e) {
200
+ sinon.logError("Fake server request processing", e);
201
+ }
202
+ },
203
+
204
+ restore: function restore() {
205
+ return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments);
206
+ }
207
+ };
208
+ }());
209
+
210
+ if (typeof module !== 'undefined' && module.exports) {
211
+ module.exports = sinon;
212
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @depend fake_server.js
3
+ * @depend fake_timers.js
4
+ */
5
+ /*jslint browser: true, eqeqeq: false, onevar: false*/
6
+ /*global sinon*/
7
+ /**
8
+ * Add-on for sinon.fakeServer that automatically handles a fake timer along with
9
+ * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
10
+ * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
11
+ * it polls the object for completion with setInterval. Dispite the direct
12
+ * motivation, there is nothing jQuery-specific in this file, so it can be used
13
+ * in any environment where the ajax implementation depends on setInterval or
14
+ * setTimeout.
15
+ *
16
+ * @author Christian Johansen (christian@cjohansen.no)
17
+ * @license BSD
18
+ *
19
+ * Copyright (c) 2010-2013 Christian Johansen
20
+ */
21
+ "use strict";
22
+
23
+ (function () {
24
+ function Server() {}
25
+ Server.prototype = sinon.fakeServer;
26
+
27
+ sinon.fakeServerWithClock = new Server();
28
+
29
+ sinon.fakeServerWithClock.addRequest = function addRequest(xhr) {
30
+ if (xhr.async) {
31
+ if (typeof setTimeout.clock == "object") {
32
+ this.clock = setTimeout.clock;
33
+ } else {
34
+ this.clock = sinon.useFakeTimers();
35
+ this.resetClock = true;
36
+ }
37
+
38
+ if (!this.longestTimeout) {
39
+ var clockSetTimeout = this.clock.setTimeout;
40
+ var clockSetInterval = this.clock.setInterval;
41
+ var server = this;
42
+
43
+ this.clock.setTimeout = function (fn, timeout) {
44
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
45
+
46
+ return clockSetTimeout.apply(this, arguments);
47
+ };
48
+
49
+ this.clock.setInterval = function (fn, timeout) {
50
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
51
+
52
+ return clockSetInterval.apply(this, arguments);
53
+ };
54
+ }
55
+ }
56
+
57
+ return sinon.fakeServer.addRequest.call(this, xhr);
58
+ };
59
+
60
+ sinon.fakeServerWithClock.respond = function respond() {
61
+ var returnVal = sinon.fakeServer.respond.apply(this, arguments);
62
+
63
+ if (this.clock) {
64
+ this.clock.tick(this.longestTimeout || 0);
65
+ this.longestTimeout = 0;
66
+
67
+ if (this.resetClock) {
68
+ this.clock.restore();
69
+ this.resetClock = false;
70
+ }
71
+ }
72
+
73
+ return returnVal;
74
+ };
75
+
76
+ sinon.fakeServerWithClock.restore = function restore() {
77
+ if (this.clock) {
78
+ this.clock.restore();
79
+ }
80
+
81
+ return sinon.fakeServer.restore.apply(this, arguments);
82
+ };
83
+ }());