jruby_activiti 1.2.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG +6 -0
  5. data/Jarfile +5 -0
  6. data/Jarfile.lock +52 -13
  7. data/README.md +21 -9
  8. data/java/build.md +3 -0
  9. data/java/mapping.md +20 -0
  10. data/java/pom.xml +30 -0
  11. data/java/src/main/java/jrubyactiviti/Modeler.java +95 -0
  12. data/java/src/main/java/jrubyactiviti/ProcessDiagram.java +491 -0
  13. data/java/src/main/java/jrubyactiviti/ProcessInstanceHighlights.java +237 -0
  14. data/java/src/main/java/jrubyactiviti/StencilsetResource.java +16 -0
  15. data/java/src/main/resources/stencilset.json +1339 -0
  16. data/jruby_activiti.gemspec +3 -2
  17. data/lib/generators/jruby_activiti/install_generator.rb +4 -0
  18. data/lib/jar/jrubyactiviti-2.0.jar +0 -0
  19. data/lib/jruby_activiti/version.rb +1 -1
  20. data/lib/jruby_activiti/web.rb +81 -0
  21. data/lib/jruby_activiti.rb +28 -20
  22. data/test/{base_test.rb → activiti_test.rb} +1 -3
  23. data/test/instance_hights_test.rb +18 -0
  24. data/test/modeler_test.rb +35 -0
  25. data/test/process_diagram_test.rb +33 -0
  26. data/test/resources/model_init_editor_source.json +1 -0
  27. data/test/resources/model_json_xml.json +278 -0
  28. data/test/resources/model_svg_xml.xml +66 -0
  29. data/test/stencilset_test.rb +7 -0
  30. data/test/test_helper.rb +2 -0
  31. data/web/public/diagram-viewer/images/bg.png +0 -0
  32. data/web/public/diagram-viewer/images/breadcrumbs.png +0 -0
  33. data/web/public/diagram-viewer/images/checker-bg.png +0 -0
  34. data/web/public/diagram-viewer/images/deployer/blue/message_catch.png +0 -0
  35. data/web/public/diagram-viewer/images/deployer/business_rule.png +0 -0
  36. data/web/public/diagram-viewer/images/deployer/error_catch.png +0 -0
  37. data/web/public/diagram-viewer/images/deployer/error_throw.png +0 -0
  38. data/web/public/diagram-viewer/images/deployer/manual.png +0 -0
  39. data/web/public/diagram-viewer/images/deployer/message_catch.png +0 -0
  40. data/web/public/diagram-viewer/images/deployer/message_throw.png +0 -0
  41. data/web/public/diagram-viewer/images/deployer/receive.png +0 -0
  42. data/web/public/diagram-viewer/images/deployer/script.png +0 -0
  43. data/web/public/diagram-viewer/images/deployer/send.png +0 -0
  44. data/web/public/diagram-viewer/images/deployer/service.png +0 -0
  45. data/web/public/diagram-viewer/images/deployer/signal_catch.png +0 -0
  46. data/web/public/diagram-viewer/images/deployer/signal_throw.png +0 -0
  47. data/web/public/diagram-viewer/images/deployer/timer.png +0 -0
  48. data/web/public/diagram-viewer/images/deployer/user.png +0 -0
  49. data/web/public/diagram-viewer/index.html +130 -0
  50. data/web/public/diagram-viewer/js/ActivitiRest.js +74 -0
  51. data/web/public/diagram-viewer/js/ActivityImpl.js +1 -0
  52. data/web/public/diagram-viewer/js/Color.js +603 -0
  53. data/web/public/diagram-viewer/js/LineBreakMeasurer.js +270 -0
  54. data/web/public/diagram-viewer/js/Polyline.js +387 -0
  55. data/web/public/diagram-viewer/js/ProcessDiagramCanvas.js +2172 -0
  56. data/web/public/diagram-viewer/js/ProcessDiagramGenerator.js +1087 -0
  57. data/web/public/diagram-viewer/js/jquery/jquery.asyncqueue.js +125 -0
  58. data/web/public/diagram-viewer/js/jquery/jquery.js +9266 -0
  59. data/web/public/diagram-viewer/js/jquery/jquery.progressbar.js +131 -0
  60. data/web/public/diagram-viewer/js/jstools.js +23 -0
  61. data/web/public/diagram-viewer/js/raphael.2.1.1.js +10 -0
  62. data/web/public/diagram-viewer/js/raphael.js +10 -0
  63. data/web/public/diagram-viewer/js/raphael_uncompressed.js +5815 -0
  64. data/web/public/diagram-viewer/js/textlayout.js +441 -0
  65. data/web/public/diagram-viewer/style.css +1 -0
  66. data/web/public/editor-app/app-cfg.js +25 -0
  67. data/web/public/editor-app/app.js +432 -0
  68. data/web/public/editor-app/configuration/properties/assignment-display-template.html +4 -0
  69. data/web/public/editor-app/configuration/properties/assignment-popup.html +44 -0
  70. data/web/public/editor-app/configuration/properties/assignment-write-template.html +4 -0
  71. data/web/public/editor-app/configuration/properties/boolean-property-template.html +4 -0
  72. data/web/public/editor-app/configuration/properties/condition-expression-display-template.html +2 -0
  73. data/web/public/editor-app/configuration/properties/condition-expression-popup.html +29 -0
  74. data/web/public/editor-app/configuration/properties/condition-expression-write-template.html +4 -0
  75. data/web/public/editor-app/configuration/properties/default-value-display-template.html +4 -0
  76. data/web/public/editor-app/configuration/properties/event-listeners-display-template.html +3 -0
  77. data/web/public/editor-app/configuration/properties/event-listeners-popup.html +115 -0
  78. data/web/public/editor-app/configuration/properties/event-listeners-write-template.html +4 -0
  79. data/web/public/editor-app/configuration/properties/execution-listeners-display-template.html +3 -0
  80. data/web/public/editor-app/configuration/properties/execution-listeners-popup.html +101 -0
  81. data/web/public/editor-app/configuration/properties/execution-listeners-write-template.html +4 -0
  82. data/web/public/editor-app/configuration/properties/feedback-popup.html +17 -0
  83. data/web/public/editor-app/configuration/properties/fields-display-template.html +3 -0
  84. data/web/public/editor-app/configuration/properties/fields-popup.html +61 -0
  85. data/web/public/editor-app/configuration/properties/fields-write-template.html +4 -0
  86. data/web/public/editor-app/configuration/properties/form-properties-display-template.html +3 -0
  87. data/web/public/editor-app/configuration/properties/form-properties-popup.html +93 -0
  88. data/web/public/editor-app/configuration/properties/form-properties-write-template.html +4 -0
  89. data/web/public/editor-app/configuration/properties/in-parameters-display-template.html +3 -0
  90. data/web/public/editor-app/configuration/properties/in-parameters-popup.html +53 -0
  91. data/web/public/editor-app/configuration/properties/in-parameters-write-template.html +4 -0
  92. data/web/public/editor-app/configuration/properties/message-definitions-display-template.html +2 -0
  93. data/web/public/editor-app/configuration/properties/message-definitions-popup.html +50 -0
  94. data/web/public/editor-app/configuration/properties/message-definitions-write-template.html +3 -0
  95. data/web/public/editor-app/configuration/properties/message-property-write-template.html +4 -0
  96. data/web/public/editor-app/configuration/properties/multiinstance-property-write-template.html +8 -0
  97. data/web/public/editor-app/configuration/properties/out-parameters-display-template.html +3 -0
  98. data/web/public/editor-app/configuration/properties/out-parameters-popup.html +53 -0
  99. data/web/public/editor-app/configuration/properties/out-parameters-write-template.html +4 -0
  100. data/web/public/editor-app/configuration/properties/sequenceflow-order-display-template.html +3 -0
  101. data/web/public/editor-app/configuration/properties/sequenceflow-order-popup.html +47 -0
  102. data/web/public/editor-app/configuration/properties/sequenceflow-order-write-template.html +4 -0
  103. data/web/public/editor-app/configuration/properties/signal-definitions-display-template.html +3 -0
  104. data/web/public/editor-app/configuration/properties/signal-definitions-popup.html +58 -0
  105. data/web/public/editor-app/configuration/properties/signal-definitions-write-template.html +4 -0
  106. data/web/public/editor-app/configuration/properties/signal-property-write-template.html +4 -0
  107. data/web/public/editor-app/configuration/properties/string-property-write-mode-template.html +8 -0
  108. data/web/public/editor-app/configuration/properties/subprocess-reference-display-template.html +3 -0
  109. data/web/public/editor-app/configuration/properties/subprocess-reference-popup.html +43 -0
  110. data/web/public/editor-app/configuration/properties/subprocess-reference-write-template.html +4 -0
  111. data/web/public/editor-app/configuration/properties/task-listeners-display-template.html +3 -0
  112. data/web/public/editor-app/configuration/properties/task-listeners-popup.html +102 -0
  113. data/web/public/editor-app/configuration/properties/task-listeners-write-template.html +4 -0
  114. data/web/public/editor-app/configuration/properties/text-popup.html +17 -0
  115. data/web/public/editor-app/configuration/properties/text-property-write-template.html +4 -0
  116. data/web/public/editor-app/configuration/properties-assignment-controller.js +150 -0
  117. data/web/public/editor-app/configuration/properties-condition-expression-controller.js +58 -0
  118. data/web/public/editor-app/configuration/properties-custom-controllers.js +18 -0
  119. data/web/public/editor-app/configuration/properties-default-controllers.js +115 -0
  120. data/web/public/editor-app/configuration/properties-event-listeners-controller.js +266 -0
  121. data/web/public/editor-app/configuration/properties-execution-listeners-controller.js +326 -0
  122. data/web/public/editor-app/configuration/properties-fields-controller.js +192 -0
  123. data/web/public/editor-app/configuration/properties-form-properties-controller.js +192 -0
  124. data/web/public/editor-app/configuration/properties-in-parameters-controller.js +158 -0
  125. data/web/public/editor-app/configuration/properties-message-definitions-controller.js +137 -0
  126. data/web/public/editor-app/configuration/properties-message-scope-controller.js +48 -0
  127. data/web/public/editor-app/configuration/properties-multiinstance-controller.js +34 -0
  128. data/web/public/editor-app/configuration/properties-out-parameters-controller.js +158 -0
  129. data/web/public/editor-app/configuration/properties-sequenceflow-order-controller.js +130 -0
  130. data/web/public/editor-app/configuration/properties-signal-definitions-controller.js +136 -0
  131. data/web/public/editor-app/configuration/properties-signal-scope-controller.js +47 -0
  132. data/web/public/editor-app/configuration/properties-task-listeners-controller.js +325 -0
  133. data/web/public/editor-app/configuration/properties.js +99 -0
  134. data/web/public/editor-app/configuration/toolbar-custom-actions.js +18 -0
  135. data/web/public/editor-app/configuration/toolbar-default-actions.js +429 -0
  136. data/web/public/editor-app/configuration/toolbar.js +175 -0
  137. data/web/public/editor-app/configuration/url-config.js +34 -0
  138. data/web/public/editor-app/css/style-common.css +1518 -0
  139. data/web/public/editor-app/css/style-editor.css +639 -0
  140. data/web/public/editor-app/css/style.css +471 -0
  141. data/web/public/editor-app/editor/css/editor.css +202 -0
  142. data/web/public/editor-app/editor/i18n/translation_de.js +383 -0
  143. data/web/public/editor-app/editor/i18n/translation_en_us.js +423 -0
  144. data/web/public/editor-app/editor/i18n/translation_signavio_de.js +106 -0
  145. data/web/public/editor-app/editor/i18n/translation_signavio_en_us.js +108 -0
  146. data/web/public/editor-app/editor/oryx.debug.js +24510 -0
  147. data/web/public/editor-app/editor/oryx.js +30 -0
  148. data/web/public/editor-app/editor-config.js +32 -0
  149. data/web/public/editor-app/editor-controller.js +65 -0
  150. data/web/public/editor-app/editor-utils.js +135 -0
  151. data/web/public/editor-app/editor.html +136 -0
  152. data/web/public/editor-app/eventbus.js +133 -0
  153. data/web/public/editor-app/fonts/activiti-admin-webfont.eot +0 -0
  154. data/web/public/editor-app/fonts/activiti-admin-webfont.svg +43 -0
  155. data/web/public/editor-app/fonts/activiti-admin-webfont.ttf +0 -0
  156. data/web/public/editor-app/fonts/activiti-admin-webfont.woff +0 -0
  157. data/web/public/editor-app/fonts/glyphicons-halflings-regular.eot +0 -0
  158. data/web/public/editor-app/fonts/glyphicons-halflings-regular.svg +229 -0
  159. data/web/public/editor-app/fonts/glyphicons-halflings-regular.ttf +0 -0
  160. data/web/public/editor-app/fonts/glyphicons-halflings-regular.woff +0 -0
  161. data/web/public/editor-app/header-controller.js +31 -0
  162. data/web/public/editor-app/i18n/en.json +286 -0
  163. data/web/public/editor-app/images/bpmn-error.png +0 -0
  164. data/web/public/editor-app/images/bpmn-warning.png +0 -0
  165. data/web/public/editor-app/images/datadefinition.png +0 -0
  166. data/web/public/editor-app/images/delete.png +0 -0
  167. data/web/public/editor-app/images/loading.gif +0 -0
  168. data/web/public/editor-app/images/logo-2x.png +0 -0
  169. data/web/public/editor-app/images/logo.png +0 -0
  170. data/web/public/editor-app/images/nw-handle-dark.gif +0 -0
  171. data/web/public/editor-app/images/se-handle-dark.gif +0 -0
  172. data/web/public/editor-app/images/shapemenu_highlight.png +0 -0
  173. data/web/public/editor-app/images/wrench.png +0 -0
  174. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js +8 -0
  175. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map +8 -0
  176. data/web/public/editor-app/libs/angular-dragdrop.min-1.0.3.js +9 -0
  177. data/web/public/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js +29 -0
  178. data/web/public/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js +2136 -0
  179. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.js +596 -0
  180. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js +13 -0
  181. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map +8 -0
  182. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.js +921 -0
  183. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js +14 -0
  184. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map +8 -0
  185. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js +625 -0
  186. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js +14 -0
  187. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map +8 -0
  188. data/web/public/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js +1 -0
  189. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js +9 -0
  190. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js +8 -0
  191. data/web/public/editor-app/libs/angular-translate-loader-static-files/.bower.json +19 -0
  192. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js +31 -0
  193. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js +6 -0
  194. data/web/public/editor-app/libs/angular-translate-storage-cookie/.bower.json +20 -0
  195. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js +19 -0
  196. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js +6 -0
  197. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.js +960 -0
  198. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js +6 -0
  199. data/web/public/editor-app/libs/angular_1.2.13/angular-animate.min.js +27 -0
  200. data/web/public/editor-app/libs/angular_1.2.13/angular.min.js +204 -0
  201. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css +267 -0
  202. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js +1026 -0
  203. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css +347 -0
  204. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map +1 -0
  205. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css +7 -0
  206. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css +5785 -0
  207. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map +1 -0
  208. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css +7 -0
  209. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot +0 -0
  210. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg +229 -0
  211. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf +0 -0
  212. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff +0 -0
  213. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +1951 -0
  214. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js +6 -0
  215. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.bower.json +14 -0
  216. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.gitignore +2 -0
  217. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CHANGES +93 -0
  218. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md +25 -0
  219. data/web/public/editor-app/libs/es5-shim-15.3.4.5/LICENSE +19 -0
  220. data/web/public/editor-app/libs/es5-shim-15.3.4.5/README.md +161 -0
  221. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js +444 -0
  222. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map +1 -0
  223. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js +4 -0
  224. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js +1314 -0
  225. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map +1 -0
  226. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js +4 -0
  227. data/web/public/editor-app/libs/es5-shim-15.3.4.5/package.json +34 -0
  228. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js +64 -0
  229. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js +34 -0
  230. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js +3 -0
  231. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.html +64 -0
  232. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html +63 -0
  233. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js +190 -0
  234. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css +166 -0
  235. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js +2477 -0
  236. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png +0 -0
  237. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js +478 -0
  238. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js +1223 -0
  239. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js +152 -0
  240. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js +147 -0
  241. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js +14 -0
  242. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js +181 -0
  243. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js +204 -0
  244. data/web/public/editor-app/libs/jquery-ui-1.10.3.custom.min.js +6 -0
  245. data/web/public/editor-app/libs/jquery.autogrow-textarea.js +61 -0
  246. data/web/public/editor-app/libs/jquery_1.11.0/jquery.js +9789 -0
  247. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.js +4 -0
  248. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.map +1 -0
  249. data/web/public/editor-app/libs/json3_3.2.6/LICENSE +20 -0
  250. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.js +861 -0
  251. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.min.js +18 -0
  252. data/web/public/editor-app/libs/momentjs_2.5.1/momentjs.min.js +6 -0
  253. data/web/public/editor-app/libs/mousetrap-1.4.5.min.js +9 -0
  254. data/web/public/editor-app/libs/ng-grid-2.0.7-min.js +2 -0
  255. data/web/public/editor-app/libs/ng-grid-2.0.7.min.css +1 -0
  256. data/web/public/editor-app/libs/path_parser.js +30 -0
  257. data/web/public/editor-app/libs/prototype-1.5.1.js +3272 -0
  258. data/web/public/editor-app/libs/ui-utils.min-0.0.4.js +7 -0
  259. data/web/public/editor-app/partials/root-stencil-item-template.html +11 -0
  260. data/web/public/editor-app/partials/stencil-item-template.html +27 -0
  261. data/web/public/editor-app/plugins.xml +58 -0
  262. data/web/public/editor-app/popups/icon-template.html +3 -0
  263. data/web/public/editor-app/popups/save-model.html +41 -0
  264. data/web/public/editor-app/popups/select-shape.html +20 -0
  265. data/web/public/editor-app/popups/unsaved-changes.html +22 -0
  266. data/web/public/editor-app/select-shape-controller.js +314 -0
  267. data/web/public/editor-app/stencil-controller.js +1421 -0
  268. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png +0 -0
  269. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png +0 -0
  270. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png +0 -0
  271. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png +0 -0
  272. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png +0 -0
  273. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png +0 -0
  274. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png +0 -0
  275. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png +0 -0
  276. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png +0 -0
  277. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png +0 -0
  278. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png +0 -0
  279. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png +0 -0
  280. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png +0 -0
  281. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png +0 -0
  282. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/task.png +0 -0
  283. data/web/public/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png +0 -0
  284. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png +0 -0
  285. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png +0 -0
  286. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/error.png +0 -0
  287. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/message.png +0 -0
  288. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png +0 -0
  289. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png +0 -0
  290. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png +0 -0
  291. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png +0 -0
  292. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png +0 -0
  293. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png +0 -0
  294. data/web/public/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png +0 -0
  295. data/web/public/editor-app/stencilsets/bpmn2.0/icons/diagram.png +0 -0
  296. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png +0 -0
  297. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png +0 -0
  298. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png +0 -0
  299. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png +0 -0
  300. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png +0 -0
  301. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png +0 -0
  302. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png +0 -0
  303. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png +0 -0
  304. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png +0 -0
  305. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png +0 -0
  306. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png +0 -0
  307. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png +0 -0
  308. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png +0 -0
  309. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png +0 -0
  310. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png +0 -0
  311. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png +0 -0
  312. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png +0 -0
  313. data/web/public/editor-app/toolbar-controller.js +162 -0
  314. data/web/public/modeler.html +140 -0
  315. data/web/views/models/index.erb +32 -0
  316. data/web/views/models/new.erb +15 -0
  317. metadata +334 -10
@@ -0,0 +1,1223 @@
1
+ describe('Array', function() {
2
+ var testSubject;
3
+ beforeEach(function() {
4
+ testSubject = [2, 3, undefined, true, 'hej', null, false, 0];
5
+ delete testSubject[1];
6
+ });
7
+ function createArrayLikeFromArray(arr) {
8
+ var o = {};
9
+ Array.prototype.forEach.call(arr, function(e, i) {
10
+ o[i]=e;
11
+ });
12
+ o.length = arr.length;
13
+ return o;
14
+ };
15
+
16
+ describe('forEach', function() {
17
+ "use strict";
18
+ var expected, actual;
19
+
20
+ beforeEach(function() {
21
+ expected = {0:2, 2: undefined, 3:true, 4: 'hej', 5:null, 6:false, 7:0 };
22
+ actual = {};
23
+ });
24
+ it('should pass the right parameters', function() {
25
+ var callback = jasmine.createSpy('callback'),
26
+ array = ['1'];
27
+ array.forEach(callback);
28
+ expect(callback).toHaveBeenCalledWith('1', 0, array);
29
+ });
30
+ it('should not affect elements added to the array after it has begun', function() {
31
+ var arr = [1,2,3],
32
+ i = 0;
33
+ arr.forEach(function(a) {
34
+ i++;
35
+ arr.push(a+3);
36
+ });
37
+ expect(arr).toEqual([1,2,3,4,5,6]);
38
+ expect(i).toBe(3);
39
+ });
40
+
41
+ it('should set the right context when given none', function() {
42
+ var context;
43
+ [1].forEach(function() {context = this;});
44
+ expect(context).toBe(function() {return this}.call());
45
+ });
46
+ it('should iterate all', function() {
47
+ testSubject.forEach(function(obj, index) {
48
+ actual[index] = obj;
49
+ });
50
+ expect(actual).toExactlyMatch(expected);
51
+ });
52
+ it('should iterate all using a context', function() {
53
+ var o = { a: actual };
54
+
55
+ testSubject.forEach(function(obj, index) {
56
+ this.a[index] = obj;
57
+ }, o);
58
+ expect(actual).toExactlyMatch(expected);
59
+ });
60
+
61
+ it('should iterate all in an array-like object', function() {
62
+ var ts = createArrayLikeFromArray(testSubject);
63
+ Array.prototype.forEach.call(ts, function(obj, index) {
64
+ actual[index] = obj;
65
+ });
66
+ expect(actual).toExactlyMatch(expected);
67
+ });
68
+ it('should iterate all in an array-like object using a context', function() {
69
+ var ts = createArrayLikeFromArray(testSubject),
70
+ o = { a: actual };
71
+
72
+ Array.prototype.forEach.call(ts, function(obj, index) {
73
+ this.a[index] = obj;
74
+ }, o);
75
+ expect(actual).toExactlyMatch(expected);
76
+ });
77
+
78
+ describe('strings', function() {
79
+ var str = 'Hello, World!',
80
+ toString = Object.prototype.toString;
81
+ it('should iterate all in a string', function() {
82
+ actual = [];
83
+ Array.prototype.forEach.call(str, function(item, index) {
84
+ actual[index] = item;
85
+ });
86
+ expect(actual).toExactlyMatch(str.split(''));
87
+ });
88
+ it('should iterate all in a string using a context', function() {
89
+ actual = [];
90
+ var o = { a: actual };
91
+ Array.prototype.forEach.call(str, function(item, index) {
92
+ this.a[index] = item;
93
+ }, o);
94
+ expect(actual).toExactlyMatch(str.split(''));
95
+ });
96
+ it('should have String object for third argument of callback', function() {
97
+ Array.prototype.forEach.call(str, function(item, index, obj) {
98
+ actual = obj;
99
+ });
100
+ expect(typeof actual).toBe("object");
101
+ expect(toString.call(actual)).toBe("[object String]");
102
+ });
103
+ });
104
+ });
105
+ describe('some', function() {
106
+ var actual, expected, numberOfRuns;
107
+
108
+ beforeEach(function() {
109
+ expected = {0:2, 2: undefined, 3:true };
110
+ actual = {};
111
+ numberOfRuns = 0;
112
+ });
113
+
114
+ it('should pass the correct values along to the callback', function() {
115
+ var callback = jasmine.createSpy('callback');
116
+ var array = ['1'];
117
+ array.some(callback);
118
+ expect(callback).toHaveBeenCalledWith('1', 0, array);
119
+ });
120
+ it('should not affect elements added to the array after it has begun', function() {
121
+ var arr = [1,2,3],
122
+ i = 0;
123
+ arr.some(function(a) {
124
+ i++;
125
+ arr.push(a+3);
126
+ return i > 3;
127
+ });
128
+ expect(arr).toEqual([1,2,3,4,5,6]);
129
+ expect(i).toBe(3);
130
+ });
131
+ it('should set the right context when given none', function() {
132
+ var context;
133
+ [1].some(function() {context = this;});
134
+ expect(context).toBe(function() {return this}.call());
135
+ });
136
+
137
+ it('should return false if it runs to the end', function() {
138
+ actual = testSubject.some(function() {});
139
+ expect(actual).toBeFalsy();
140
+ });
141
+ it('should return true if it is stopped somewhere', function() {
142
+ actual = testSubject.some(function() { return true; });
143
+ expect(actual).toBeTruthy();
144
+ });
145
+ it('should return false if there are no elements', function() {
146
+ actual = [].some(function() { return true; });
147
+ expect(actual).toBeFalsy();
148
+ });
149
+
150
+ it('should stop after 3 elements', function() {
151
+ testSubject.some(function(obj, index) {
152
+ actual[index] = obj;
153
+ numberOfRuns += 1;
154
+ if(numberOfRuns == 3) {
155
+ return true;
156
+ }
157
+ return false;
158
+ });
159
+ expect(actual).toExactlyMatch(expected);
160
+ });
161
+ it('should stop after 3 elements using a context', function() {
162
+ var o = { a: actual };
163
+ testSubject.some(function(obj, index) {
164
+ this.a[index] = obj;
165
+ numberOfRuns += 1;
166
+ if(numberOfRuns == 3) {
167
+ return true;
168
+ }
169
+ return false;
170
+ }, o);
171
+ expect(actual).toExactlyMatch(expected);
172
+ });
173
+
174
+ it('should stop after 3 elements in an array-like object', function() {
175
+ var ts = createArrayLikeFromArray(testSubject);
176
+ Array.prototype.some.call(ts, function(obj, index) {
177
+ actual[index] = obj;
178
+ numberOfRuns += 1;
179
+ if(numberOfRuns == 3) {
180
+ return true;
181
+ }
182
+ return false;
183
+ });
184
+ expect(actual).toExactlyMatch(expected);
185
+ });
186
+ it('should stop after 3 elements in an array-like object using a context', function() {
187
+ var ts = createArrayLikeFromArray(testSubject);
188
+ var o = { a: actual };
189
+ Array.prototype.some.call(ts, function(obj, index) {
190
+ this.a[index] = obj;
191
+ numberOfRuns += 1;
192
+ if(numberOfRuns == 3) {
193
+ return true;
194
+ }
195
+ return false;
196
+ }, o);
197
+ expect(actual).toExactlyMatch(expected);
198
+ });
199
+ });
200
+ describe('every', function() {
201
+ var actual, expected, numberOfRuns;
202
+
203
+ beforeEach(function() {
204
+ expected = {0:2, 2: undefined, 3:true };
205
+ actual = {};
206
+ numberOfRuns = 0;
207
+ });
208
+
209
+ it('should pass the correct values along to the callback', function() {
210
+ var callback = jasmine.createSpy('callback');
211
+ var array = ['1'];
212
+ array.every(callback);
213
+ expect(callback).toHaveBeenCalledWith('1', 0, array);
214
+ });
215
+ it('should not affect elements added to the array after it has begun', function() {
216
+ var arr = [1,2,3],
217
+ i = 0;
218
+ arr.every(function(a) {
219
+ i++;
220
+ arr.push(a+3);
221
+ return i <= 3;
222
+ });
223
+ expect(arr).toEqual([1,2,3,4,5,6]);
224
+ expect(i).toBe(3);
225
+ });
226
+ it('should set the right context when given none', function() {
227
+ var context;
228
+ [1].every(function() {context = this;});
229
+ expect(context).toBe(function() {return this}.call());
230
+ });
231
+
232
+ it('should return true if the array is empty', function() {
233
+ actual = [].every(function() { return true; });
234
+ expect(actual).toBeTruthy();
235
+
236
+ actual = [].every(function() { return false; });
237
+ expect(actual).toBeTruthy();
238
+ });
239
+ it('should return true if it runs to the end', function() {
240
+ actual = [1,2,3].every(function() { return true; });
241
+ expect(actual).toBeTruthy();
242
+ });
243
+ it('should return false if it is stopped before the end', function() {
244
+ actual = [1,2,3].every(function() { return false; });
245
+ expect(actual).toBeFalsy();
246
+ });
247
+
248
+ it('should return after 3 elements', function() {
249
+ testSubject.every(function(obj, index) {
250
+ actual[index] = obj;
251
+ numberOfRuns += 1;
252
+ if(numberOfRuns == 3) {
253
+ return false;
254
+ }
255
+ return true;
256
+ });
257
+ expect(actual).toExactlyMatch(expected);
258
+ });
259
+ it('should stop after 3 elements using a context', function() {
260
+ var o = { a: actual };
261
+ testSubject.every(function(obj, index) {
262
+ this.a[index] = obj;
263
+ numberOfRuns += 1;
264
+ if(numberOfRuns == 3) {
265
+ return false;
266
+ }
267
+ return true;
268
+ }, o);
269
+ expect(actual).toExactlyMatch(expected);
270
+ });
271
+
272
+ it('should stop after 3 elements in an array-like object', function() {
273
+ var ts = createArrayLikeFromArray(testSubject);
274
+ Array.prototype.every.call(ts, function(obj, index) {
275
+ actual[index] = obj;
276
+ numberOfRuns += 1;
277
+ if(numberOfRuns == 3) {
278
+ return false;
279
+ }
280
+ return true;
281
+ });
282
+ expect(actual).toExactlyMatch(expected);
283
+ });
284
+ it('should stop after 3 elements in an array-like object using a context', function() {
285
+ var ts = createArrayLikeFromArray(testSubject);
286
+ var o = { a: actual };
287
+ Array.prototype.every.call(ts, function(obj, index) {
288
+ this.a[index] = obj;
289
+ numberOfRuns += 1;
290
+ if(numberOfRuns == 3) {
291
+ return false;
292
+ }
293
+ return true;
294
+ }, o);
295
+ expect(actual).toExactlyMatch(expected);
296
+ });
297
+ });
298
+
299
+ describe('indexOf', function() {
300
+ "use strict";
301
+ var actual, expected, testSubject;
302
+
303
+ beforeEach(function() {
304
+ testSubject = [2, 3, undefined, true, 'hej', null, 2, false, 0];
305
+ delete testSubject[1];
306
+
307
+ });
308
+
309
+ it('should find the element', function() {
310
+ expected = 4;
311
+ actual = testSubject.indexOf('hej');
312
+ expect(actual).toEqual(expected);
313
+ });
314
+ it('should not find the element', function() {
315
+ expected = -1;
316
+ actual = testSubject.indexOf('mus');
317
+ expect(actual).toEqual(expected);
318
+ });
319
+ it('should find undefined as well', function() {
320
+ expected = -1;
321
+ actual = testSubject.indexOf(undefined);
322
+ expect(actual).not.toEqual(expected);
323
+ });
324
+ it('should skip unset indexes', function() {
325
+ expected = 2;
326
+ actual = testSubject.indexOf(undefined);
327
+ expect(actual).toEqual(expected);
328
+ });
329
+ it('should use a strict test', function() {
330
+ actual = testSubject.indexOf(null);
331
+ expect(actual).toEqual(5);
332
+
333
+ actual = testSubject.indexOf('2');
334
+ expect(actual).toEqual(-1);
335
+ });
336
+ it('should skip the first if fromIndex is set', function() {
337
+ expect(testSubject.indexOf(2, 2)).toEqual(6);
338
+ expect(testSubject.indexOf(2, 0)).toEqual(0);
339
+ expect(testSubject.indexOf(2, 6)).toEqual(6);
340
+ });
341
+ it('should work with negative fromIndex', function() {
342
+ expect(testSubject.indexOf(2, -3)).toEqual(6);
343
+ expect(testSubject.indexOf(2, -9)).toEqual(0);
344
+ });
345
+ it('should work with fromIndex being greater than the length', function() {
346
+ expect(testSubject.indexOf(0, 20)).toEqual(-1);
347
+ });
348
+ it('should work with fromIndex being negative and greater than the length', function() {
349
+ expect(testSubject.indexOf('hej', -20)).toEqual(4);
350
+ });
351
+
352
+ describe('Array-like', function ArrayLike() {
353
+ var indexOf = Array.prototype.indexOf,
354
+ testAL;
355
+ beforeEach(function beforeEach() {
356
+ testAL = {};
357
+ testSubject = [2, 3, undefined, true, 'hej', null, 2, false, 0];
358
+ testSubject.forEach(function (o,i) {
359
+ testAL[i] = o;
360
+ });
361
+ testAL.length = testSubject.length;
362
+ });
363
+ it('should find the element (array-like)', function() {
364
+ expected = 4;
365
+ actual = indexOf.call(testAL, 'hej');
366
+ expect(actual).toEqual(expected);
367
+ });
368
+ it('should not find the element (array-like)', function() {
369
+ expected = -1;
370
+ actual = indexOf.call(testAL, 'mus');
371
+ expect(actual).toEqual(expected);
372
+ });
373
+ it('should find undefined as well (array-like)', function() {
374
+ expected = -1;
375
+ actual = indexOf.call(testAL, undefined);
376
+ expect(actual).not.toEqual(expected);
377
+ });
378
+ it('should skip unset indexes (array-like)', function() {
379
+ expected = 2;
380
+ actual = indexOf.call(testAL, undefined);
381
+ expect(actual).toEqual(expected);
382
+ });
383
+ it('should use a strict test (array-like)', function() {
384
+ actual = Array.prototype.indexOf.call(testAL, null);
385
+ expect(actual).toEqual(5);
386
+
387
+ actual = Array.prototype.indexOf.call(testAL, '2');
388
+ expect(actual).toEqual(-1);
389
+ });
390
+ it('should skip the first if fromIndex is set (array-like)', function() {
391
+ expect(indexOf.call(testAL, 2, 2)).toEqual(6);
392
+ expect(indexOf.call(testAL, 2, 0)).toEqual(0);
393
+ expect(indexOf.call(testAL, 2, 6)).toEqual(6);
394
+ });
395
+ it('should work with negative fromIndex (array-like)', function() {
396
+ expect(indexOf.call(testAL, 2, -3)).toEqual(6);
397
+ expect(indexOf.call(testAL, 2, -9)).toEqual(0);
398
+ });
399
+ it('should work with fromIndex being greater than the length (array-like)', function() {
400
+ expect(indexOf.call(testAL, 0, 20)).toEqual(-1);
401
+ });
402
+ it('should work with fromIndex being negative and greater than the length (array-like)', function() {
403
+ expect(indexOf.call(testAL, 'hej', -20)).toEqual(4);
404
+ });
405
+ });
406
+ });
407
+ describe('lastIndexOf', function() {
408
+ "use strict";
409
+ var actual, expected, testSubject, testAL;
410
+
411
+ beforeEach(function() {
412
+ testSubject = [2, 3, undefined, true, 'hej', null, 2, 3, false, 0];
413
+ delete testSubject[1];
414
+ delete testSubject[7];
415
+ });
416
+ describe('Array', function() {
417
+ it('should find the element', function() {
418
+ expected = 4;
419
+ actual = testSubject.lastIndexOf('hej');
420
+ expect(actual).toEqual(expected);
421
+ });
422
+ it('should not find the element', function() {
423
+ expected = -1;
424
+ actual = testSubject.lastIndexOf('mus');
425
+ expect(actual).toEqual(expected);
426
+ });
427
+ it('should find undefined as well', function() {
428
+ expected = -1;
429
+ actual = testSubject.lastIndexOf(undefined);
430
+ expect(actual).not.toEqual(expected);
431
+ });
432
+ it('should skip unset indexes', function() {
433
+ expected = 2;
434
+ actual = testSubject.lastIndexOf(undefined);
435
+ expect(actual).toEqual(expected);
436
+ });
437
+ it('should use a strict test', function() {
438
+ actual = testSubject.lastIndexOf(null);
439
+ expect(actual).toEqual(5);
440
+
441
+ actual = testSubject.lastIndexOf('2');
442
+ expect(actual).toEqual(-1);
443
+ });
444
+ it('should skip the first if fromIndex is set', function() {
445
+ expect(testSubject.lastIndexOf(2, 2)).toEqual(0);
446
+ expect(testSubject.lastIndexOf(2, 0)).toEqual(0);
447
+ expect(testSubject.lastIndexOf(2, 6)).toEqual(6);
448
+ });
449
+ it('should work with negative fromIndex', function() {
450
+ expect(testSubject.lastIndexOf(2, -3)).toEqual(6);
451
+ expect(testSubject.lastIndexOf(2, -9)).toEqual(0);
452
+ });
453
+ it('should work with fromIndex being greater than the length', function() {
454
+ expect(testSubject.lastIndexOf(2, 20)).toEqual(6);
455
+ });
456
+ it('should work with fromIndex being negative and greater than the length', function() {
457
+ expect(testSubject.lastIndexOf(2, -20)).toEqual(-1);
458
+ });
459
+ });
460
+
461
+ describe('Array like', function() {
462
+ var lastIndexOf = Array.prototype.lastIndexOf,
463
+ testAL;
464
+ beforeEach(function() {
465
+ testAL = {};
466
+ testSubject.forEach(function (o,i) {
467
+ testAL[i] = o;
468
+ });
469
+ testAL.length = testSubject.length;
470
+ });
471
+ it('should find the element (array-like)', function() {
472
+ expected = 4;
473
+ actual = lastIndexOf.call(testAL, 'hej');
474
+ expect(actual).toEqual(expected);
475
+ });
476
+ it('should not find the element (array-like)', function() {
477
+ expected = -1;
478
+ actual = lastIndexOf.call(testAL, 'mus');
479
+ expect(actual).toEqual(expected);
480
+ });
481
+ it('should find undefined as well (array-like)', function() {
482
+ expected = -1;
483
+ actual = lastIndexOf.call(testAL, undefined);
484
+ expect(actual).not.toEqual(expected);
485
+ });
486
+ it('should skip unset indexes (array-like)', function() {
487
+ expected = 2;
488
+ actual = lastIndexOf.call(testAL, undefined);
489
+ expect(actual).toEqual(expected);
490
+ });
491
+ it('should use a strict test (array-like)', function() {
492
+ actual = lastIndexOf.call(testAL, null);
493
+ expect(actual).toEqual(5);
494
+
495
+ actual = lastIndexOf.call(testAL, '2');
496
+ expect(actual).toEqual(-1);
497
+ });
498
+ it('should skip the first if fromIndex is set', function() {
499
+ expect(lastIndexOf.call(testAL, 2, 2)).toEqual(0);
500
+ expect(lastIndexOf.call(testAL, 2, 0)).toEqual(0);
501
+ expect(lastIndexOf.call(testAL, 2, 6)).toEqual(6);
502
+ });
503
+ it('should work with negative fromIndex', function() {
504
+ expect(lastIndexOf.call(testAL, 2, -3)).toEqual(6);
505
+ expect(lastIndexOf.call(testAL, 2, -9)).toEqual(0);
506
+ });
507
+ it('should work with fromIndex being greater than the length', function() {
508
+ expect(lastIndexOf.call(testAL, 2, 20)).toEqual(6);
509
+ });
510
+ it('should work with fromIndex being negative and greater than the length', function() {
511
+ expect(lastIndexOf.call(testAL, 2, -20)).toEqual(-1);
512
+ });
513
+ });
514
+ });
515
+
516
+ describe('filter', function() {
517
+ var filteredArray,
518
+ callback = function callback(o, i, arr) {
519
+ return (
520
+ i != 3 && i != 5
521
+ );
522
+ };
523
+
524
+ beforeEach(function() {
525
+ testSubject = [2, 3, undefined, true, 'hej', 3, null, false, 0];
526
+ delete testSubject[1];
527
+ filteredArray = [2, undefined, 'hej', null, false, 0];
528
+ });
529
+ describe('Array object', function() {
530
+
531
+ it('should call the callback with the proper arguments', function() {
532
+ var callback = jasmine.createSpy('callback'),
533
+ arr = ['1'];
534
+ arr.filter(callback);
535
+ expect(callback).toHaveBeenCalledWith('1', 0, arr);
536
+ });
537
+ it('should not affect elements added to the array after it has begun', function() {
538
+ var arr = [1,2,3],
539
+ i = 0;
540
+ arr.filter(function(a) {
541
+ i++;
542
+ if(i <= 4) {
543
+ arr.push(a+3);
544
+ }
545
+ return true;
546
+ });
547
+ expect(arr).toEqual([1,2,3,4,5,6]);
548
+ expect(i).toBe(3);
549
+ });
550
+ it('should skip non-set values', function() {
551
+ var passedValues = {};
552
+ testSubject = [1,2,3,4];
553
+ delete testSubject[1];
554
+ testSubject.filter(function(o, i) {
555
+ passedValues[i] = o;
556
+ return true;
557
+ });
558
+ expect(passedValues).toExactlyMatch(testSubject);
559
+ });
560
+ it('should pass the right context to the filter', function() {
561
+ var passedValues = {};
562
+ testSubject = [1,2,3,4];
563
+ delete testSubject[1];
564
+ testSubject.filter(function(o, i) {
565
+ this[i] = o;
566
+ return true;
567
+ }, passedValues);
568
+ expect(passedValues).toExactlyMatch(testSubject);
569
+ });
570
+ it('should set the right context when given none', function() {
571
+ var context;
572
+ [1].filter(function() {context = this;});
573
+ expect(context).toBe(function() {return this}.call());
574
+ });
575
+ it('should remove only the values for which the callback returns false', function() {
576
+ var result = testSubject.filter(callback);
577
+ expect(result).toExactlyMatch(filteredArray);
578
+ });
579
+ it('should leave the original array untouched', function() {
580
+ var copy = testSubject.slice();
581
+ testSubject.filter(callback);
582
+ expect(testSubject).toExactlyMatch(copy);
583
+ });
584
+ it('should not be affected by same-index mutation', function () {
585
+ var results = [1, 2, 3]
586
+ .filter(function (value, index, array) {
587
+ array[index] = 'a';
588
+ return true;
589
+ });
590
+ expect(results).toEqual([1, 2, 3]);
591
+ });
592
+ });
593
+ describe('Array like', function() {
594
+ beforeEach(function() {
595
+ testSubject = createArrayLikeFromArray(testSubject);
596
+ });
597
+ it('should call the callback with the proper arguments', function() {
598
+ var callback = jasmine.createSpy('callback'),
599
+ arr = createArrayLikeFromArray(['1']);
600
+ Array.prototype.filter.call(arr, callback);
601
+ expect(callback).toHaveBeenCalledWith('1', 0, arr);
602
+ });
603
+ it('should not affect elements added to the array after it has begun', function() {
604
+ var arr = createArrayLikeFromArray([1,2,3]),
605
+ i = 0;
606
+ Array.prototype.filter.call(arr, function(a) {
607
+ i++;
608
+ if(i <= 4) {
609
+ arr[i+2] = a+3;
610
+ }
611
+ return true;
612
+ });
613
+ delete arr.length;
614
+ expect(arr).toExactlyMatch([1,2,3,4,5,6]);
615
+ expect(i).toBe(3);
616
+ });
617
+ it('should skip non-set values', function() {
618
+ var passedValues = {};
619
+ testSubject = createArrayLikeFromArray([1,2,3,4]);
620
+ delete testSubject[1];
621
+ Array.prototype.filter.call(testSubject, function(o, i) {
622
+ passedValues[i] = o;
623
+ return true;
624
+ });
625
+ delete testSubject.length;
626
+ expect(passedValues).toExactlyMatch(testSubject);
627
+ });
628
+ it('should set the right context when given none', function() {
629
+ var context;
630
+ Array.prototype.filter.call(createArrayLikeFromArray([1]), function() {context = this;}, undefined);
631
+ expect(context).toBe(function() {return this}.call());
632
+ });
633
+ it('should pass the right context to the filter', function() {
634
+ var passedValues = {};
635
+ testSubject = createArrayLikeFromArray([1,2,3,4]);
636
+ delete testSubject[1];
637
+ Array.prototype.filter.call(testSubject, function(o, i) {
638
+ this[i] = o;
639
+ return true;
640
+ }, passedValues);
641
+ delete testSubject.length;
642
+ expect(passedValues).toExactlyMatch(testSubject);
643
+ });
644
+ it('should remove only the values for which the callback returns false', function() {
645
+ var result = Array.prototype.filter.call(testSubject, callback);
646
+ expect(result).toExactlyMatch(filteredArray);
647
+ });
648
+ it('should leave the original array untouched', function() {
649
+ var copy = createArrayLikeFromArray(testSubject);
650
+ Array.prototype.filter.call(testSubject, callback);
651
+ expect(testSubject).toExactlyMatch(copy);
652
+ });
653
+ });
654
+ });
655
+ describe('map', function() {
656
+ var callback;
657
+ beforeEach(function() {
658
+ var i = 0;
659
+ callback = function() {
660
+ return i++;
661
+ };
662
+ });
663
+ describe('Array object', function() {
664
+ it('should call callback with the right parameters', function() {
665
+ var callback = jasmine.createSpy('callback'),
666
+ array = [1];
667
+ array.map(callback);
668
+ expect(callback).toHaveBeenCalledWith(1, 0, array);
669
+ });
670
+ it('should set the context correctly', function() {
671
+ var context = {};
672
+ testSubject.map(function(o,i) {
673
+ this[i] = o;
674
+ }, context);
675
+ expect(context).toExactlyMatch(testSubject);
676
+ });
677
+ it('should set the right context when given none', function() {
678
+ var context;
679
+ [1].map(function() {context = this;});
680
+ expect(context).toBe(function() {return this}.call());
681
+ });
682
+ it('should not change the array it is called on', function() {
683
+ var copy = testSubject.slice();
684
+ testSubject.map(callback);
685
+ expect(testSubject).toExactlyMatch(copy);
686
+ });
687
+ it('should only run for the number of objects in the array when it started', function() {
688
+ var arr = [1,2,3],
689
+ i = 0;
690
+ arr.map(function(o) {
691
+ arr.push(o+3);
692
+ i++;
693
+ return o;
694
+ });
695
+ expect(arr).toExactlyMatch([1,2,3,4,5,6]);
696
+ expect(i).toBe(3);
697
+ });
698
+ it('should properly translate the values as according to the callback', function() {
699
+ var result = testSubject.map(callback),
700
+ expected = [0,0,1,2,3,4,5,6];
701
+ delete expected[1];
702
+ expect(result).toExactlyMatch(expected);
703
+ });
704
+ it('should skip non-existing values', function() {
705
+ var array = [1,2,3,4],
706
+ i = 0;
707
+ delete array[2];
708
+ array.map(function() {
709
+ i++;
710
+ });
711
+ expect(i).toBe(3);
712
+ });
713
+ });
714
+ describe('Array-like', function() {
715
+ beforeEach(function() {
716
+ testSubject = createArrayLikeFromArray(testSubject);
717
+ });
718
+ it('should call callback with the right parameters', function() {
719
+ var callback = jasmine.createSpy('callback'),
720
+ array = createArrayLikeFromArray([1]);
721
+ Array.prototype.map.call(array, callback);
722
+ expect(callback).toHaveBeenCalledWith(1, 0, array);
723
+ });
724
+ it('should set the context correctly', function() {
725
+ var context = {};
726
+ Array.prototype.map.call(testSubject, function(o,i) {
727
+ this[i] = o;
728
+ }, context);
729
+ delete testSubject.length;
730
+ expect(context).toExactlyMatch(testSubject);
731
+ });
732
+ it('should set the right context when given none', function() {
733
+ var context;
734
+ Array.prototype.map.call(createArrayLikeFromArray([1]), function() {context = this;});
735
+ expect(context).toBe(function() {return this}.call());
736
+ });
737
+ it('should not change the array it is called on', function() {
738
+ var copy = createArrayLikeFromArray(testSubject);
739
+ Array.prototype.map.call(testSubject, callback);
740
+ expect(testSubject).toExactlyMatch(copy);
741
+ });
742
+ it('should only run for the number of objects in the array when it started', function() {
743
+ var arr = createArrayLikeFromArray([1,2,3]),
744
+ i = 0;
745
+ Array.prototype.map.call(arr, function(o) {
746
+ Array.prototype.push.call(arr, o+3);
747
+ i++;
748
+ return o;
749
+ });
750
+ delete arr.length;
751
+ expect(arr).toExactlyMatch([1,2,3,4,5,6]);
752
+ expect(i).toBe(3);
753
+ });
754
+ it('should properly translate the values as according to the callback', function() {
755
+ var result = Array.prototype.map.call(testSubject, callback),
756
+ expected = [0,0,1,2,3,4,5,6];
757
+ delete expected[1];
758
+ expect(result).toExactlyMatch(expected);
759
+ });
760
+ it('should skip non-existing values', function() {
761
+ var array = createArrayLikeFromArray([1,2,3,4]),
762
+ i = 0;
763
+ delete array[2];
764
+ Array.prototype.map.call(array, function() {
765
+ i++;
766
+ });
767
+ expect(i).toBe(3);
768
+ });
769
+ });
770
+ });
771
+
772
+ describe('reduce', function() {
773
+ beforeEach(function() {
774
+ testSubject = [1,2,3];
775
+ });
776
+
777
+ describe('Array', function() {
778
+ it('should pass the correct arguments to the callback', function() {
779
+ var spy = jasmine.createSpy().andReturn(0);
780
+ testSubject.reduce(spy);
781
+ expect(spy.calls[0].args).toExactlyMatch([1, 2, 1, testSubject]);
782
+ });
783
+ it('should start with the right initialValue', function() {
784
+ var spy = jasmine.createSpy().andReturn(0);
785
+ testSubject.reduce(spy, 0);
786
+ expect(spy.calls[0].args).toExactlyMatch([0, 1, 0, testSubject]);
787
+ });
788
+ it('should not affect elements added to the array after it has begun', function() {
789
+ var arr = [1,2,3],
790
+ i = 0;
791
+ arr.reduce(function(a, b) {
792
+ i++;
793
+ if(i <= 4) {
794
+ arr.push(a+3);
795
+ };
796
+ return b;
797
+ });
798
+ expect(arr).toEqual([1,2,3,4,5]);
799
+ expect(i).toBe(2);
800
+ });
801
+ it('should work as expected for empty arrays', function() {
802
+ var spy = jasmine.createSpy();
803
+ expect(function() {
804
+ [].reduce(spy);
805
+ }).toThrow();
806
+ expect(spy).not.toHaveBeenCalled();
807
+ });
808
+ it('should throw correctly if no callback is given', function() {
809
+ expect(function() {
810
+ testSubject.reduce();
811
+ }).toThrow();
812
+ });
813
+ it('should return the expected result', function() {
814
+ expect(testSubject.reduce(function(a,b) {
815
+ return (a||'').toString()+(b||'').toString();
816
+ })).toEqual(testSubject.join(''));
817
+ });
818
+ it('should not directly affect the passed array', function() {
819
+ var copy = testSubject.slice();
820
+ testSubject.reduce(function(a,b) {
821
+ return a+b;
822
+ });
823
+ expect(testSubject).toEqual(copy);
824
+ });
825
+ it('should skip non-set values', function() {
826
+ delete testSubject[1];
827
+ var visited = {};
828
+ testSubject.reduce(function(a,b) {
829
+ if(a)
830
+ visited[a] = true;
831
+ if(b)
832
+ visited[b] = true;
833
+ return 0;
834
+ });
835
+
836
+ expect(visited).toEqual({ '1': true, '3': true });
837
+ });
838
+ it('should have the right length', function() {
839
+ expect(testSubject.reduce.length).toBe(1);
840
+ });
841
+ });
842
+ describe('Array-like objects', function() {
843
+ beforeEach(function() {
844
+ testSubject = createArrayLikeFromArray(testSubject);
845
+ testSubject.reduce = Array.prototype.reduce;
846
+ });
847
+ it('should pass the correct arguments to the callback', function() {
848
+ var spy = jasmine.createSpy().andReturn(0);
849
+ testSubject.reduce(spy);
850
+ expect(spy.calls[0].args).toExactlyMatch([1, 2, 1, testSubject]);
851
+ });
852
+ it('should start with the right initialValue', function() {
853
+ var spy = jasmine.createSpy().andReturn(0);
854
+ testSubject.reduce(spy, 0);
855
+ expect(spy.calls[0].args).toExactlyMatch([0, 1, 0, testSubject]);
856
+ });
857
+ it('should not affect elements added to the array after it has begun', function() {
858
+ var arr = createArrayLikeFromArray([1,2,3]),
859
+ i = 0;
860
+ Array.prototype.reduce.call(arr, function(a, b) {
861
+ i++;
862
+ if(i <= 4) {
863
+ arr[i+2] = a+3;
864
+ };
865
+ return b;
866
+ });
867
+ expect(arr).toEqual({
868
+ 0: 1,
869
+ 1: 2,
870
+ 2: 3,
871
+ 3: 4,
872
+ 4: 5,
873
+ length: 3
874
+ });
875
+ expect(i).toBe(2);
876
+ });
877
+ it('should work as expected for empty arrays', function() {
878
+ var spy = jasmine.createSpy();
879
+ expect(function() {
880
+ Array.prototype.reduce.call({length: 0}, spy);
881
+ }).toThrow();
882
+ expect(spy).not.toHaveBeenCalled();
883
+ });
884
+ it('should throw correctly if no callback is given', function() {
885
+ expect(function() {
886
+ testSubject.reduce();
887
+ }).toThrow();
888
+ });
889
+ it('should return the expected result', function() {
890
+ expect(testSubject.reduce(function(a,b) {
891
+ return (a||'').toString()+(b||'').toString();
892
+ })).toEqual('123');
893
+ });
894
+ it('should not directly affect the passed array', function() {
895
+ var copy = createArrayLikeFromArray(testSubject);
896
+ testSubject.reduce(function(a,b) {
897
+ return a+b;
898
+ });
899
+ delete(testSubject.reduce);
900
+ expect(testSubject).toEqual(copy);
901
+ });
902
+ it('should skip non-set values', function() {
903
+ delete testSubject[1];
904
+ var visited = {};
905
+ testSubject.reduce(function(a,b) {
906
+ if(a)
907
+ visited[a] = true;
908
+ if(b)
909
+ visited[b] = true;
910
+ return 0;
911
+ });
912
+
913
+ expect(visited).toEqual({ '1': true, '3': true });
914
+ });
915
+ it('should have the right length', function() {
916
+ expect(testSubject.reduce.length).toBe(1);
917
+ });
918
+ });
919
+ });
920
+ describe('reduceRight', function() {
921
+ beforeEach(function() {
922
+ testSubject = [1,2,3];
923
+ });
924
+
925
+ describe('Array', function() {
926
+ it('should pass the correct arguments to the callback', function() {
927
+ var spy = jasmine.createSpy().andReturn(0);
928
+ testSubject.reduceRight(spy);
929
+ expect(spy.calls[0].args).toExactlyMatch([3, 2, 1, testSubject]);
930
+ });
931
+ it('should start with the right initialValue', function() {
932
+ var spy = jasmine.createSpy().andReturn(0);
933
+ testSubject.reduceRight(spy, 0);
934
+ expect(spy.calls[0].args).toExactlyMatch([0, 3, 2, testSubject]);
935
+ });
936
+ it('should not affect elements added to the array after it has begun', function() {
937
+ var arr = [1,2,3],
938
+ i = 0;
939
+ arr.reduceRight(function(a, b) {
940
+ i++;
941
+ if(i <= 4) {
942
+ arr.push(a+3);
943
+ };
944
+ return b;
945
+ });
946
+ expect(arr).toEqual([1,2,3,6,5]);
947
+ expect(i).toBe(2);
948
+ });
949
+ it('should work as expected for empty arrays', function() {
950
+ var spy = jasmine.createSpy();
951
+ expect(function() {
952
+ [].reduceRight(spy);
953
+ }).toThrow();
954
+ expect(spy).not.toHaveBeenCalled();
955
+ });
956
+ it('should work as expected for empty arrays with an initial value', function() {
957
+ var spy = jasmine.createSpy(),
958
+ result;
959
+
960
+ result = [].reduceRight(spy, '');
961
+ expect(spy).not.toHaveBeenCalled();
962
+ expect(result).toBe('');
963
+ });
964
+ it('should throw correctly if no callback is given', function() {
965
+ expect(function() {
966
+ testSubject.reduceRight();
967
+ }).toThrow();
968
+ });
969
+ it('should return the expected result', function() {
970
+ expect(testSubject.reduceRight(function(a,b) {
971
+ return (a||'').toString()+(b||'').toString();
972
+ })).toEqual('321');
973
+ });
974
+ it('should not directly affect the passed array', function() {
975
+ var copy = testSubject.slice();
976
+ testSubject.reduceRight(function(a,b) {
977
+ return a+b;
978
+ });
979
+ expect(testSubject).toEqual(copy);
980
+ });
981
+ it('should skip non-set values', function() {
982
+ delete testSubject[1];
983
+ var visited = {};
984
+ testSubject.reduceRight(function(a,b) {
985
+ if(a)
986
+ visited[a] = true;
987
+ if(b)
988
+ visited[b] = true;
989
+ return 0;
990
+ });
991
+
992
+ expect(visited).toEqual({ '1': true, '3': true });
993
+ });
994
+ it('should have the right length', function() {
995
+ expect(testSubject.reduceRight.length).toBe(1);
996
+ });
997
+ });
998
+ describe('Array-like objects', function() {
999
+ beforeEach(function() {
1000
+ testSubject = createArrayLikeFromArray(testSubject);
1001
+ testSubject.reduceRight = Array.prototype.reduceRight;
1002
+ });
1003
+ it('should pass the correct arguments to the callback', function() {
1004
+ var spy = jasmine.createSpy().andReturn(0);
1005
+ testSubject.reduceRight(spy);
1006
+ expect(spy.calls[0].args).toExactlyMatch([3, 2, 1, testSubject]);
1007
+ });
1008
+ it('should start with the right initialValue', function() {
1009
+ var spy = jasmine.createSpy().andReturn(0);
1010
+ testSubject.reduceRight(spy, 0);
1011
+ expect(spy.calls[0].args).toExactlyMatch([0, 3, 2, testSubject]);
1012
+ });
1013
+ it('should not affect elements added to the array after it has begun', function() {
1014
+ var arr = createArrayLikeFromArray([1,2,3]),
1015
+ i = 0;
1016
+ Array.prototype.reduceRight.call(arr, function(a, b) {
1017
+ i++;
1018
+ if(i <= 4) {
1019
+ arr[i+2] = a+3;
1020
+ };
1021
+ return b;
1022
+ });
1023
+ expect(arr).toEqual({
1024
+ 0: 1,
1025
+ 1: 2,
1026
+ 2: 3,
1027
+ 3: 6,
1028
+ 4: 5,
1029
+ length: 3 // does not get updated on property assignment
1030
+ });
1031
+ expect(i).toBe(2);
1032
+ });
1033
+ it('should work as expected for empty arrays', function() {
1034
+ var spy = jasmine.createSpy();
1035
+ expect(function() {
1036
+ Array.prototype.reduceRight.call({length:0}, spy);
1037
+ }).toThrow();
1038
+ expect(spy).not.toHaveBeenCalled();
1039
+ });
1040
+ it('should throw correctly if no callback is given', function() {
1041
+ expect(function() {
1042
+ testSubject.reduceRight();
1043
+ }).toThrow();
1044
+ });
1045
+ it('should return the expected result', function() {
1046
+ expect(testSubject.reduceRight(function(a,b) {
1047
+ return (a||'').toString()+(b||'').toString();
1048
+ })).toEqual('321');
1049
+ });
1050
+ it('should not directly affect the passed array', function() {
1051
+ var copy = createArrayLikeFromArray(testSubject);
1052
+ testSubject.reduceRight(function(a,b) {
1053
+ return a+b;
1054
+ });
1055
+ delete(testSubject.reduceRight);
1056
+ expect(testSubject).toEqual(copy);
1057
+ });
1058
+ it('should skip non-set values', function() {
1059
+ delete testSubject[1];
1060
+ var visited = {};
1061
+ testSubject.reduceRight(function(a,b) {
1062
+ if(a)
1063
+ visited[a] = true;
1064
+ if(b)
1065
+ visited[b] = true;
1066
+ return 0;
1067
+ });
1068
+
1069
+ expect(visited).toEqual({ '1': true, '3': true });
1070
+ });
1071
+ it('should have the right length', function() {
1072
+ expect(testSubject.reduceRight.length).toBe(1);
1073
+ });
1074
+ });
1075
+ });
1076
+
1077
+ describe('isArray', function () {
1078
+ it('should work for Array', function () {
1079
+ var ret = Array.isArray([]);
1080
+
1081
+ expect(ret).toBe(true);
1082
+ });
1083
+
1084
+ it('should fail for other objects', function () {
1085
+ var objects = [
1086
+ "someString",
1087
+ true,
1088
+ false,
1089
+ 42,
1090
+ 0,
1091
+ {},
1092
+ Object.create && Object.create(null) || null,
1093
+ /foo/,
1094
+ arguments,
1095
+ document.getElementsByTagName("div")
1096
+ ];
1097
+
1098
+ objects.forEach(function (v) {
1099
+ expect(Array.isArray(v)).toBe(false);
1100
+ });
1101
+ });
1102
+ });
1103
+
1104
+ describe('unshift', function () {
1105
+ it('should return length', function () {
1106
+ expect([].unshift(0)).toEqual(1);
1107
+ });
1108
+ });
1109
+
1110
+ describe('splice', function () {
1111
+ var b = ["b"],
1112
+ a = [1, "a", b],
1113
+ test;
1114
+
1115
+ var makeArray = function(l, prefix) {
1116
+ prefix = prefix || "";
1117
+ var a = [];
1118
+ while (l--) {
1119
+ a.unshift(prefix + Array(l + 1).join(" ") + l)
1120
+ }
1121
+ return a
1122
+ };
1123
+
1124
+ beforeEach(function() {
1125
+ test = a.slice(0);
1126
+ });
1127
+
1128
+ it('basic implementation test 1', function () {
1129
+ expect(test.splice(0)).toEqual(a);
1130
+ });
1131
+ it('basic implementation test 2', function () {
1132
+ test.splice(0, 2);
1133
+ expect(test).toEqual([b]);
1134
+ });
1135
+
1136
+ it('should return right result 1', function () {
1137
+ expect((function() {
1138
+ var array = [];
1139
+
1140
+ array.splice(0, 0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
1141
+ array.splice(1, 0, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26");
1142
+ array.splice(5, 0, "XXX");
1143
+
1144
+ return array.join("|");
1145
+ }())).toBe("1|F1|F2|F3|F4|XXX|F5|F6|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20");
1146
+ });
1147
+
1148
+ it('should return right result 2', function () {
1149
+ expect((function() {
1150
+ var array = makeArray(6);
1151
+
1152
+ array.splice(array.length - 1, 1, "");
1153
+ array.splice(0, 1, 1,2,3,4);
1154
+ array.splice(0, 0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21, 22, 23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45);
1155
+
1156
+ array.splice(4, 0, "99999999999999");
1157
+ return array.join("|");
1158
+ }())).toBe("1|2|3|4|99999999999999|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|1|2|3|4| 1| 2| 3| 4|");
1159
+ });
1160
+
1161
+ it('should return right result 3', function () {
1162
+ expect((function() {
1163
+ var array = [1,2,3];
1164
+
1165
+ array.splice(0);
1166
+ array.splice(0, 1, 1,2,3,4,5,6,7,8,9,10);
1167
+ array.splice(1, 1, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26");
1168
+ array.splice(5, 1, "YYY", "XXX");
1169
+ array.splice(0, 1);
1170
+ array.splice(0, 2);
1171
+ array.pop();
1172
+ array.push.apply(array, makeArray(10, "-"));
1173
+ array.splice(array.length - 2, 10);
1174
+ array.splice();
1175
+ array.splice(1, 1, 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9);
1176
+ array.splice(1, 1, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26",1,23,4,5,6,7,8);
1177
+ array.splice(30, 10);
1178
+ array.splice(30, 1);
1179
+ array.splice(30, 0);
1180
+ array.splice(2, 5, 1,2,3,"P", "LLL", "CCC", "YYY", "XXX");
1181
+ array.push(1,2,3,4,5,6);
1182
+ array.splice(1, 6, 1,2,3,4,5,6,7,8,9,4,5,6,7,8,9);
1183
+ array.splice(3, 7);
1184
+ array.unshift(7,8,9,10,11);
1185
+ array.pop();
1186
+ array.splice(5, 2);
1187
+ array.pop();
1188
+ array.unshift.apply(array, makeArray(8, "~"));
1189
+ array.pop();
1190
+ array.splice(3, 1, "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21","F22", "F23", "F24", "F25", "F26",1,23,4,5,6,7,8);
1191
+ array.splice(4, 5, "P", "LLL", "CCC", "YYY", "XXX");
1192
+
1193
+ return array.join("|");
1194
+ }())).toBe("~0|~ 1|~ 2|F1|P|LLL|CCC|YYY|XXX|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|1|23|4|5|6|7|8|~ 4|~ 5|~ 6|~ 7|7|8|9|10|11|2|4|5|6|7|8|9|CCC|YYY|XXX|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|1|23|4|9|10|1|2|3|4|5|6|7|8|9|YYY|XXX|F6|F7|F8|F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|F25|F26|3|4|5|6|7|8|9|-0|- 1|- 2|- 3|- 4|- 5|- 6|- 7|1|2|3");
1195
+ });
1196
+
1197
+
1198
+ it('should do nothing if method called with no arguments', function () {
1199
+ expect(test.splice()).toEqual([]);
1200
+ expect(test).toEqual(a);
1201
+ });
1202
+ //TODO:: Is this realy TRUE behavior?
1203
+ it('should set first argument to 0 if first argument is set but undefined', function () {
1204
+ var test2 = test.slice(0);
1205
+ expect(test.splice(void 0, 2)).toEqual(test2.splice(0, 2));
1206
+ expect(test).toEqual(test2);
1207
+ });
1208
+
1209
+ it('should deleted and return all items after "start" when second argument is undefined', function () {
1210
+ expect(test.splice(0)).toEqual(a);
1211
+ expect(test).toEqual([]);
1212
+ });
1213
+ it('should deleted and return all items after "start" when second argument is undefined', function () {
1214
+ expect(test.splice(2)).toEqual([b]);
1215
+ expect(test).toEqual([1, "a"]);
1216
+ });
1217
+ it('runshould have the right length', function () {
1218
+ expect(test.splice.length).toBe(2);
1219
+ });
1220
+ });
1221
+
1222
+
1223
+ });