extjs-rails 4.1.0.alpha5 → 4.1.0.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (507) hide show
  1. data/app/assets/javascripts/extjs-rails.js +95613 -11000
  2. data/lib/extjs-rails/version.rb +1 -1
  3. metadata +2 -509
  4. data/app/assets/javascripts/src/AbstractComponent.js +0 -3290
  5. data/app/assets/javascripts/src/AbstractManager.js +0 -144
  6. data/app/assets/javascripts/src/AbstractPlugin.js +0 -72
  7. data/app/assets/javascripts/src/Action.js +0 -276
  8. data/app/assets/javascripts/src/Ajax.js +0 -99
  9. data/app/assets/javascripts/src/Component.js +0 -1344
  10. data/app/assets/javascripts/src/ComponentLoader.js +0 -202
  11. data/app/assets/javascripts/src/ComponentManager.js +0 -47
  12. data/app/assets/javascripts/src/ComponentQuery.js +0 -521
  13. data/app/assets/javascripts/src/Editor.js +0 -494
  14. data/app/assets/javascripts/src/ElementLoader.js +0 -404
  15. data/app/assets/javascripts/src/FocusManager.js +0 -712
  16. data/app/assets/javascripts/src/Img.js +0 -111
  17. data/app/assets/javascripts/src/Layer.js +0 -543
  18. data/app/assets/javascripts/src/LoadMask.js +0 -432
  19. data/app/assets/javascripts/src/ModelManager.js +0 -186
  20. data/app/assets/javascripts/src/PluginManager.js +0 -110
  21. data/app/assets/javascripts/src/ProgressBar.js +0 -336
  22. data/app/assets/javascripts/src/Shadow.js +0 -233
  23. data/app/assets/javascripts/src/ShadowPool.js +0 -43
  24. data/app/assets/javascripts/src/Template.js +0 -331
  25. data/app/assets/javascripts/src/XTemplate.js +0 -365
  26. data/app/assets/javascripts/src/XTemplateCompiler.js +0 -450
  27. data/app/assets/javascripts/src/XTemplateParser.js +0 -249
  28. data/app/assets/javascripts/src/ZIndexManager.js +0 -519
  29. data/app/assets/javascripts/src/app/Application.js +0 -271
  30. data/app/assets/javascripts/src/app/Controller.js +0 -458
  31. data/app/assets/javascripts/src/app/EventBus.js +0 -112
  32. data/app/assets/javascripts/src/button/Button.js +0 -1483
  33. data/app/assets/javascripts/src/button/Cycle.js +0 -215
  34. data/app/assets/javascripts/src/button/Split.js +0 -99
  35. data/app/assets/javascripts/src/chart/Callout.js +0 -140
  36. data/app/assets/javascripts/src/chart/Chart.js +0 -966
  37. data/app/assets/javascripts/src/chart/Highlight.js +0 -172
  38. data/app/assets/javascripts/src/chart/Label.js +0 -241
  39. data/app/assets/javascripts/src/chart/Legend.js +0 -474
  40. data/app/assets/javascripts/src/chart/LegendItem.js +0 -217
  41. data/app/assets/javascripts/src/chart/Mask.js +0 -230
  42. data/app/assets/javascripts/src/chart/MaskLayer.js +0 -48
  43. data/app/assets/javascripts/src/chart/Navigation.js +0 -79
  44. data/app/assets/javascripts/src/chart/Shape.js +0 -106
  45. data/app/assets/javascripts/src/chart/Tip.js +0 -98
  46. data/app/assets/javascripts/src/chart/TipSurface.js +0 -42
  47. data/app/assets/javascripts/src/chart/axis/Abstract.js +0 -73
  48. data/app/assets/javascripts/src/chart/axis/Axis.js +0 -961
  49. data/app/assets/javascripts/src/chart/axis/Category.js +0 -130
  50. data/app/assets/javascripts/src/chart/axis/Gauge.js +0 -203
  51. data/app/assets/javascripts/src/chart/axis/Numeric.js +0 -235
  52. data/app/assets/javascripts/src/chart/axis/Radial.js +0 -204
  53. data/app/assets/javascripts/src/chart/axis/Time.js +0 -135
  54. data/app/assets/javascripts/src/chart/series/Area.js +0 -803
  55. data/app/assets/javascripts/src/chart/series/Bar.js +0 -853
  56. data/app/assets/javascripts/src/chart/series/Cartesian.js +0 -328
  57. data/app/assets/javascripts/src/chart/series/Column.js +0 -104
  58. data/app/assets/javascripts/src/chart/series/Gauge.js +0 -490
  59. data/app/assets/javascripts/src/chart/series/Line.js +0 -1104
  60. data/app/assets/javascripts/src/chart/series/Pie.js +0 -1072
  61. data/app/assets/javascripts/src/chart/series/Radar.js +0 -440
  62. data/app/assets/javascripts/src/chart/series/Scatter.js +0 -668
  63. data/app/assets/javascripts/src/chart/series/Series.js +0 -443
  64. data/app/assets/javascripts/src/chart/theme/Base.js +0 -175
  65. data/app/assets/javascripts/src/chart/theme/Theme.js +0 -253
  66. data/app/assets/javascripts/src/container/AbstractContainer.js +0 -1062
  67. data/app/assets/javascripts/src/container/ButtonGroup.js +0 -143
  68. data/app/assets/javascripts/src/container/Container.js +0 -212
  69. data/app/assets/javascripts/src/container/DockingContainer.js +0 -265
  70. data/app/assets/javascripts/src/container/Viewport.js +0 -184
  71. data/app/assets/javascripts/src/core/dom/Element.form.js +0 -50
  72. data/app/assets/javascripts/src/core/dom/Element.static-more.js +0 -159
  73. data/app/assets/javascripts/src/core/examples/index.html +0 -321
  74. data/app/assets/javascripts/src/core/examples/index.js +0 -6
  75. data/app/assets/javascripts/src/core/examples/src/Sample/CTO.js +0 -25
  76. data/app/assets/javascripts/src/core/examples/src/Sample/CoolGuy.js +0 -20
  77. data/app/assets/javascripts/src/core/examples/src/Sample/Developer.js +0 -43
  78. data/app/assets/javascripts/src/core/examples/src/Sample/Gun.js +0 -3
  79. data/app/assets/javascripts/src/core/examples/src/Sample/HumanResource.js +0 -23
  80. data/app/assets/javascripts/src/core/examples/src/Sample/Musician.js +0 -20
  81. data/app/assets/javascripts/src/core/examples/src/Sample/Person.js +0 -50
  82. data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanComposeSongs.js +0 -9
  83. data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanPlayGuitar.js +0 -9
  84. data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanSing.js +0 -18
  85. data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/A.js +0 -3
  86. data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/B.js +0 -3
  87. data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/C.js +0 -3
  88. data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/D.js +0 -3
  89. data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/E.js +0 -3
  90. data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/A.js +0 -3
  91. data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/B.js +0 -4
  92. data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/C.js +0 -3
  93. data/app/assets/javascripts/src/core/src/EventManager.js +0 -1167
  94. data/app/assets/javascripts/src/core/src/EventObject.js +0 -883
  95. data/app/assets/javascripts/src/core/src/Ext-more.js +0 -1283
  96. data/app/assets/javascripts/src/core/src/Ext.js +0 -736
  97. data/app/assets/javascripts/src/core/src/Support.js +0 -662
  98. data/app/assets/javascripts/src/core/src/class/Base.js +0 -1085
  99. data/app/assets/javascripts/src/core/src/class/Class.js +0 -676
  100. data/app/assets/javascripts/src/core/src/class/ClassManager.js +0 -1591
  101. data/app/assets/javascripts/src/core/src/class/Loader.js +0 -1423
  102. data/app/assets/javascripts/src/core/src/dom/AbstractElement.alignment.js +0 -173
  103. data/app/assets/javascripts/src/core/src/dom/AbstractElement.insertion.js +0 -193
  104. data/app/assets/javascripts/src/core/src/dom/AbstractElement.js +0 -681
  105. data/app/assets/javascripts/src/core/src/dom/AbstractElement.position.js +0 -356
  106. data/app/assets/javascripts/src/core/src/dom/AbstractElement.static.js +0 -474
  107. data/app/assets/javascripts/src/core/src/dom/AbstractElement.style.js +0 -851
  108. data/app/assets/javascripts/src/core/src/dom/AbstractElement.traversal.js +0 -180
  109. data/app/assets/javascripts/src/core/src/dom/AbstractHelper.js +0 -291
  110. data/app/assets/javascripts/src/core/src/dom/AbstractQuery.js +0 -72
  111. data/app/assets/javascripts/src/core/src/dom/CompositeElement.js +0 -75
  112. data/app/assets/javascripts/src/core/src/dom/CompositeElementLite.js +0 -436
  113. data/app/assets/javascripts/src/core/src/dom/DomQuery-aria.js +0 -1049
  114. data/app/assets/javascripts/src/core/src/env/Browser.js +0 -186
  115. data/app/assets/javascripts/src/core/src/env/FeatureDetector.js +0 -274
  116. data/app/assets/javascripts/src/core/src/env/OS.js +0 -141
  117. data/app/assets/javascripts/src/core/src/lang/Array.js +0 -1205
  118. data/app/assets/javascripts/src/core/src/lang/Date.js +0 -1463
  119. data/app/assets/javascripts/src/core/src/lang/Error.js +0 -326
  120. data/app/assets/javascripts/src/core/src/lang/Function.js +0 -485
  121. data/app/assets/javascripts/src/core/src/lang/Number.js +0 -175
  122. data/app/assets/javascripts/src/core/src/lang/Object.js +0 -606
  123. data/app/assets/javascripts/src/core/src/lang/String.js +0 -333
  124. data/app/assets/javascripts/src/core/src/misc/JSON.js +0 -236
  125. data/app/assets/javascripts/src/core/src/perf/Accumulator.js +0 -244
  126. data/app/assets/javascripts/src/core/src/perf/Monitor.js +0 -197
  127. data/app/assets/javascripts/src/core/src/util/DelayedTask.js +0 -71
  128. data/app/assets/javascripts/src/core/src/util/Event.js +0 -215
  129. data/app/assets/javascripts/src/core/src/util/Format.js +0 -551
  130. data/app/assets/javascripts/src/core/src/util/TaskManager.js +0 -417
  131. data/app/assets/javascripts/src/core/src/version/Version.js +0 -364
  132. data/app/assets/javascripts/src/core/test/unit/README.MD +0 -91
  133. data/app/assets/javascripts/src/core/test/unit/bootstrap.js +0 -39
  134. data/app/assets/javascripts/src/core/test/unit/build/build-data.js +0 -34
  135. data/app/assets/javascripts/src/core/test/unit/build/build.sh +0 -2
  136. data/app/assets/javascripts/src/core/test/unit/data.js +0 -27
  137. data/app/assets/javascripts/src/core/test/unit/index.html +0 -15
  138. data/app/assets/javascripts/src/core/test/unit/other_specs/dom.html +0 -40
  139. data/app/assets/javascripts/src/core/test/unit/other_specs/dom/extjs-api.js +0 -12
  140. data/app/assets/javascripts/src/core/test/unit/other_specs/dom/platform-api.js +0 -134
  141. data/app/assets/javascripts/src/core/test/unit/other_specs/dom/sanity.js +0 -4
  142. data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api-out.js +0 -128
  143. data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api.js +0 -89
  144. data/app/assets/javascripts/src/core/test/unit/other_specs/env/Environment.js +0 -357
  145. data/app/assets/javascripts/src/core/test/unit/resources/APITest.js +0 -37
  146. data/app/assets/javascripts/src/core/test/unit/resources/jsb3.js +0 -14
  147. data/app/assets/javascripts/src/core/test/unit/resources/test-setup.js +0 -137
  148. data/app/assets/javascripts/src/core/test/unit/spec/EventManager.js +0 -629
  149. data/app/assets/javascripts/src/core/test/unit/spec/Ext-mess.backup +0 -198
  150. data/app/assets/javascripts/src/core/test/unit/spec/Ext-more.js +0 -520
  151. data/app/assets/javascripts/src/core/test/unit/spec/Ext.js +0 -1550
  152. data/app/assets/javascripts/src/core/test/unit/spec/Support.js +0 -250
  153. data/app/assets/javascripts/src/core/test/unit/spec/class/Base.js +0 -47
  154. data/app/assets/javascripts/src/core/test/unit/spec/class/Class.js +0 -561
  155. data/app/assets/javascripts/src/core/test/unit/spec/class/ClassManager.js +0 -555
  156. data/app/assets/javascripts/src/core/test/unit/spec/dom/CompositeElementLite.js +0 -409
  157. data/app/assets/javascripts/src/core/test/unit/spec/dom/DomHelper.js +0 -444
  158. data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.insertion.js +0 -342
  159. data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.js +0 -731
  160. data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.static.js +0 -201
  161. data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.style.js +0 -118
  162. data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.traversal.js +0 -336
  163. data/app/assets/javascripts/src/core/test/unit/spec/lang/Array.js +0 -1229
  164. data/app/assets/javascripts/src/core/test/unit/spec/lang/Date.js +0 -697
  165. data/app/assets/javascripts/src/core/test/unit/spec/lang/Error.js +0 -277
  166. data/app/assets/javascripts/src/core/test/unit/spec/lang/Function.js +0 -536
  167. data/app/assets/javascripts/src/core/test/unit/spec/lang/Number.js +0 -323
  168. data/app/assets/javascripts/src/core/test/unit/spec/lang/Object.js +0 -591
  169. data/app/assets/javascripts/src/core/test/unit/spec/lang/String.js +0 -451
  170. data/app/assets/javascripts/src/core/test/unit/spec/misc/JSON.js +0 -252
  171. data/app/assets/javascripts/src/core/test/unit/spec/util/Format.js +0 -521
  172. data/app/assets/javascripts/src/core/test/unit/spec/version/Version.js +0 -148
  173. data/app/assets/javascripts/src/core/test/unit/specs.html +0 -19
  174. data/app/assets/javascripts/src/data/AbstractStore.js +0 -887
  175. data/app/assets/javascripts/src/data/ArrayStore.js +0 -74
  176. data/app/assets/javascripts/src/data/Batch.js +0 -236
  177. data/app/assets/javascripts/src/data/BufferStore.js +0 -13
  178. data/app/assets/javascripts/src/data/Connection.js +0 -969
  179. data/app/assets/javascripts/src/data/DirectStore.js +0 -50
  180. data/app/assets/javascripts/src/data/Errors.js +0 -52
  181. data/app/assets/javascripts/src/data/Field.js +0 -341
  182. data/app/assets/javascripts/src/data/IdGenerator.js +0 -198
  183. data/app/assets/javascripts/src/data/JsonP.js +0 -253
  184. data/app/assets/javascripts/src/data/JsonPStore.js +0 -51
  185. data/app/assets/javascripts/src/data/JsonStore.js +0 -60
  186. data/app/assets/javascripts/src/data/Model.js +0 -1673
  187. data/app/assets/javascripts/src/data/NodeInterface.js +0 -1294
  188. data/app/assets/javascripts/src/data/NodeStore.js +0 -254
  189. data/app/assets/javascripts/src/data/Operation.js +0 -331
  190. data/app/assets/javascripts/src/data/Request.js +0 -40
  191. data/app/assets/javascripts/src/data/ResultSet.js +0 -56
  192. data/app/assets/javascripts/src/data/SequentialIdGenerator.js +0 -61
  193. data/app/assets/javascripts/src/data/SortTypes.js +0 -125
  194. data/app/assets/javascripts/src/data/Store.js +0 -2609
  195. data/app/assets/javascripts/src/data/StoreManager.js +0 -156
  196. data/app/assets/javascripts/src/data/Tree.js +0 -290
  197. data/app/assets/javascripts/src/data/TreeStore.js +0 -655
  198. data/app/assets/javascripts/src/data/Types.js +0 -190
  199. data/app/assets/javascripts/src/data/UuidGenerator.js +0 -215
  200. data/app/assets/javascripts/src/data/XmlStore.js +0 -76
  201. data/app/assets/javascripts/src/data/association/Association.js +0 -243
  202. data/app/assets/javascripts/src/data/association/BelongsTo.js +0 -291
  203. data/app/assets/javascripts/src/data/association/HasMany.js +0 -289
  204. data/app/assets/javascripts/src/data/association/HasOne.js +0 -304
  205. data/app/assets/javascripts/src/data/proxy/Ajax.js +0 -282
  206. data/app/assets/javascripts/src/data/proxy/Client.js +0 -21
  207. data/app/assets/javascripts/src/data/proxy/Direct.js +0 -181
  208. data/app/assets/javascripts/src/data/proxy/JsonP.js +0 -313
  209. data/app/assets/javascripts/src/data/proxy/LocalStorage.js +0 -69
  210. data/app/assets/javascripts/src/data/proxy/Memory.js +0 -156
  211. data/app/assets/javascripts/src/data/proxy/Proxy.js +0 -433
  212. data/app/assets/javascripts/src/data/proxy/Rest.js +0 -173
  213. data/app/assets/javascripts/src/data/proxy/Server.js +0 -460
  214. data/app/assets/javascripts/src/data/proxy/SessionStorage.js +0 -39
  215. data/app/assets/javascripts/src/data/proxy/WebStorage.js +0 -546
  216. data/app/assets/javascripts/src/data/reader/Array.js +0 -68
  217. data/app/assets/javascripts/src/data/reader/Json.js +0 -383
  218. data/app/assets/javascripts/src/data/reader/Reader.js +0 -735
  219. data/app/assets/javascripts/src/data/reader/Xml.js +0 -292
  220. data/app/assets/javascripts/src/data/validations.js +0 -149
  221. data/app/assets/javascripts/src/data/writer/Json.js +0 -81
  222. data/app/assets/javascripts/src/data/writer/Writer.js +0 -147
  223. data/app/assets/javascripts/src/data/writer/Xml.js +0 -88
  224. data/app/assets/javascripts/src/dd/DD.js +0 -300
  225. data/app/assets/javascripts/src/dd/DDProxy.js +0 -204
  226. data/app/assets/javascripts/src/dd/DDTarget.js +0 -171
  227. data/app/assets/javascripts/src/dd/DragDrop.js +0 -1101
  228. data/app/assets/javascripts/src/dd/DragDropManager.js +0 -1264
  229. data/app/assets/javascripts/src/dd/DragSource.js +0 -392
  230. data/app/assets/javascripts/src/dd/DragTracker.js +0 -562
  231. data/app/assets/javascripts/src/dd/DragZone.js +0 -137
  232. data/app/assets/javascripts/src/dd/DropTarget.js +0 -118
  233. data/app/assets/javascripts/src/dd/DropZone.js +0 -254
  234. data/app/assets/javascripts/src/dd/Registry.js +0 -117
  235. data/app/assets/javascripts/src/dd/ScrollManager.js +0 -218
  236. data/app/assets/javascripts/src/dd/StatusProxy.js +0 -179
  237. data/app/assets/javascripts/src/diag/layout/Context.js +0 -523
  238. data/app/assets/javascripts/src/diag/layout/ContextItem.js +0 -179
  239. data/app/assets/javascripts/src/direct/Event.js +0 -35
  240. data/app/assets/javascripts/src/direct/ExceptionEvent.js +0 -16
  241. data/app/assets/javascripts/src/direct/JsonProvider.js +0 -82
  242. data/app/assets/javascripts/src/direct/Manager.js +0 -263
  243. data/app/assets/javascripts/src/direct/PollingProvider.js +0 -156
  244. data/app/assets/javascripts/src/direct/Provider.js +0 -96
  245. data/app/assets/javascripts/src/direct/RemotingEvent.js +0 -24
  246. data/app/assets/javascripts/src/direct/RemotingMethod.js +0 -100
  247. data/app/assets/javascripts/src/direct/RemotingProvider.js +0 -510
  248. data/app/assets/javascripts/src/direct/Transaction.js +0 -41
  249. data/app/assets/javascripts/src/dom/Element.alignment.js +0 -378
  250. data/app/assets/javascripts/src/dom/Element.anim.js +0 -962
  251. data/app/assets/javascripts/src/dom/Element.dd.js +0 -40
  252. data/app/assets/javascripts/src/dom/Element.fx.js +0 -194
  253. data/app/assets/javascripts/src/dom/Element.js +0 -1407
  254. data/app/assets/javascripts/src/dom/Element.position.js +0 -501
  255. data/app/assets/javascripts/src/dom/Element.scroll.js +0 -214
  256. data/app/assets/javascripts/src/dom/Element.style.js +0 -792
  257. data/app/assets/javascripts/src/dom/Element.traversal.js +0 -8
  258. data/app/assets/javascripts/src/dom/Helper.js +0 -466
  259. data/app/assets/javascripts/src/dom/Query.js +0 -1067
  260. data/app/assets/javascripts/src/draw/Color.js +0 -303
  261. data/app/assets/javascripts/src/draw/Component.js +0 -245
  262. data/app/assets/javascripts/src/draw/CompositeSprite.js +0 -299
  263. data/app/assets/javascripts/src/draw/Draw.js +0 -1217
  264. data/app/assets/javascripts/src/draw/Matrix.js +0 -183
  265. data/app/assets/javascripts/src/draw/Sprite.js +0 -554
  266. data/app/assets/javascripts/src/draw/SpriteDD.js +0 -87
  267. data/app/assets/javascripts/src/draw/Surface.js +0 -1001
  268. data/app/assets/javascripts/src/draw/Text.js +0 -175
  269. data/app/assets/javascripts/src/draw/engine/ImageExporter.js +0 -106
  270. data/app/assets/javascripts/src/draw/engine/Svg.js +0 -734
  271. data/app/assets/javascripts/src/draw/engine/SvgExporter.js +0 -280
  272. data/app/assets/javascripts/src/draw/engine/Vml.js +0 -916
  273. data/app/assets/javascripts/src/flash/Component.js +0 -248
  274. data/app/assets/javascripts/src/form/Basic.js +0 -1018
  275. data/app/assets/javascripts/src/form/CheckboxGroup.js +0 -441
  276. data/app/assets/javascripts/src/form/CheckboxManager.js +0 -26
  277. data/app/assets/javascripts/src/form/FieldAncestor.js +0 -210
  278. data/app/assets/javascripts/src/form/FieldContainer.js +0 -290
  279. data/app/assets/javascripts/src/form/FieldSet.js +0 -506
  280. data/app/assets/javascripts/src/form/Label.js +0 -110
  281. data/app/assets/javascripts/src/form/Labelable.js +0 -764
  282. data/app/assets/javascripts/src/form/Panel.js +0 -335
  283. data/app/assets/javascripts/src/form/RadioGroup.js +0 -124
  284. data/app/assets/javascripts/src/form/RadioManager.js +0 -26
  285. data/app/assets/javascripts/src/form/action/Action.js +0 -307
  286. data/app/assets/javascripts/src/form/action/DirectLoad.js +0 -107
  287. data/app/assets/javascripts/src/form/action/DirectSubmit.js +0 -119
  288. data/app/assets/javascripts/src/form/action/Load.js +0 -120
  289. data/app/assets/javascripts/src/form/action/StandardSubmit.js +0 -34
  290. data/app/assets/javascripts/src/form/action/Submit.js +0 -257
  291. data/app/assets/javascripts/src/form/field/Base.js +0 -813
  292. data/app/assets/javascripts/src/form/field/Checkbox.js +0 -505
  293. data/app/assets/javascripts/src/form/field/ComboBox.js +0 -1427
  294. data/app/assets/javascripts/src/form/field/Date.js +0 -578
  295. data/app/assets/javascripts/src/form/field/Display.js +0 -155
  296. data/app/assets/javascripts/src/form/field/Field.js +0 -430
  297. data/app/assets/javascripts/src/form/field/File.js +0 -265
  298. data/app/assets/javascripts/src/form/field/Hidden.js +0 -75
  299. data/app/assets/javascripts/src/form/field/HtmlEditor.js +0 -1439
  300. data/app/assets/javascripts/src/form/field/Number.js +0 -380
  301. data/app/assets/javascripts/src/form/field/Picker.js +0 -321
  302. data/app/assets/javascripts/src/form/field/Radio.js +0 -279
  303. data/app/assets/javascripts/src/form/field/Spinner.js +0 -321
  304. data/app/assets/javascripts/src/form/field/Text.js +0 -727
  305. data/app/assets/javascripts/src/form/field/TextArea.js +0 -228
  306. data/app/assets/javascripts/src/form/field/Time.js +0 -459
  307. data/app/assets/javascripts/src/form/field/Trigger.js +0 -469
  308. data/app/assets/javascripts/src/form/field/VTypes.js +0 -172
  309. data/app/assets/javascripts/src/fx/Anim.js +0 -472
  310. data/app/assets/javascripts/src/fx/Animator.js +0 -410
  311. data/app/assets/javascripts/src/fx/CubicBezier.js +0 -77
  312. data/app/assets/javascripts/src/fx/Easing.js +0 -136
  313. data/app/assets/javascripts/src/fx/Manager.js +0 -353
  314. data/app/assets/javascripts/src/fx/PropertyHandler.js +0 -381
  315. data/app/assets/javascripts/src/fx/Queue.js +0 -123
  316. data/app/assets/javascripts/src/fx/target/Component.js +0 -118
  317. data/app/assets/javascripts/src/fx/target/CompositeElement.js +0 -46
  318. data/app/assets/javascripts/src/fx/target/CompositeElementCSS.js +0 -22
  319. data/app/assets/javascripts/src/fx/target/CompositeSprite.js +0 -34
  320. data/app/assets/javascripts/src/fx/target/Element.js +0 -83
  321. data/app/assets/javascripts/src/fx/target/ElementCSS.js +0 -77
  322. data/app/assets/javascripts/src/fx/target/Sprite.js +0 -128
  323. data/app/assets/javascripts/src/fx/target/Target.js +0 -36
  324. data/app/assets/javascripts/src/grid/CellEditor.js +0 -172
  325. data/app/assets/javascripts/src/grid/ColumnComponentLayout.js +0 -34
  326. data/app/assets/javascripts/src/grid/ColumnLayout.js +0 -201
  327. data/app/assets/javascripts/src/grid/Lockable.js +0 -863
  328. data/app/assets/javascripts/src/grid/LockingView.js +0 -169
  329. data/app/assets/javascripts/src/grid/PagingScroller.js +0 -539
  330. data/app/assets/javascripts/src/grid/Panel.js +0 -393
  331. data/app/assets/javascripts/src/grid/RowEditor.js +0 -731
  332. data/app/assets/javascripts/src/grid/RowNumberer.js +0 -76
  333. data/app/assets/javascripts/src/grid/Scroller.js +0 -5
  334. data/app/assets/javascripts/src/grid/View.js +0 -44
  335. data/app/assets/javascripts/src/grid/ViewDropZone.js +0 -41
  336. data/app/assets/javascripts/src/grid/column/Action.js +0 -318
  337. data/app/assets/javascripts/src/grid/column/Boolean.js +0 -82
  338. data/app/assets/javascripts/src/grid/column/Column.js +0 -835
  339. data/app/assets/javascripts/src/grid/column/Date.js +0 -63
  340. data/app/assets/javascripts/src/grid/column/Number.js +0 -52
  341. data/app/assets/javascripts/src/grid/column/Template.js +0 -58
  342. data/app/assets/javascripts/src/grid/feature/AbstractSummary.js +0 -154
  343. data/app/assets/javascripts/src/grid/feature/Chunking.js +0 -77
  344. data/app/assets/javascripts/src/grid/feature/Feature.js +0 -158
  345. data/app/assets/javascripts/src/grid/feature/Grouping.js +0 -822
  346. data/app/assets/javascripts/src/grid/feature/GroupingSummary.js +0 -243
  347. data/app/assets/javascripts/src/grid/feature/RowBody.js +0 -116
  348. data/app/assets/javascripts/src/grid/feature/RowWrap.js +0 -120
  349. data/app/assets/javascripts/src/grid/feature/Summary.js +0 -167
  350. data/app/assets/javascripts/src/grid/header/Container.js +0 -965
  351. data/app/assets/javascripts/src/grid/header/DragZone.js +0 -69
  352. data/app/assets/javascripts/src/grid/header/DropZone.js +0 -265
  353. data/app/assets/javascripts/src/grid/plugin/CellEditing.js +0 -453
  354. data/app/assets/javascripts/src/grid/plugin/DragDrop.js +0 -254
  355. data/app/assets/javascripts/src/grid/plugin/Editing.js +0 -561
  356. data/app/assets/javascripts/src/grid/plugin/HeaderReorderer.js +0 -49
  357. data/app/assets/javascripts/src/grid/plugin/HeaderResizer.js +0 -292
  358. data/app/assets/javascripts/src/grid/plugin/RowEditing.js +0 -339
  359. data/app/assets/javascripts/src/grid/property/Grid.js +0 -351
  360. data/app/assets/javascripts/src/grid/property/HeaderContainer.js +0 -109
  361. data/app/assets/javascripts/src/grid/property/Property.js +0 -36
  362. data/app/assets/javascripts/src/grid/property/Store.js +0 -141
  363. data/app/assets/javascripts/src/layout/ClassList.js +0 -90
  364. data/app/assets/javascripts/src/layout/Context.js +0 -1232
  365. data/app/assets/javascripts/src/layout/ContextItem.js +0 -1470
  366. data/app/assets/javascripts/src/layout/Layout.js +0 -761
  367. data/app/assets/javascripts/src/layout/component/Auto.js +0 -220
  368. data/app/assets/javascripts/src/layout/component/Body.js +0 -80
  369. data/app/assets/javascripts/src/layout/component/BoundList.js +0 -95
  370. data/app/assets/javascripts/src/layout/component/Button.js +0 -261
  371. data/app/assets/javascripts/src/layout/component/Component.js +0 -427
  372. data/app/assets/javascripts/src/layout/component/Dock.js +0 -1132
  373. data/app/assets/javascripts/src/layout/component/Draw.js +0 -79
  374. data/app/assets/javascripts/src/layout/component/FieldSet.js +0 -62
  375. data/app/assets/javascripts/src/layout/component/ProgressBar.js +0 -54
  376. data/app/assets/javascripts/src/layout/component/Tab.js +0 -23
  377. data/app/assets/javascripts/src/layout/component/field/ComboBox.js +0 -52
  378. data/app/assets/javascripts/src/layout/component/field/Field.js +0 -372
  379. data/app/assets/javascripts/src/layout/component/field/FieldContainer.js +0 -48
  380. data/app/assets/javascripts/src/layout/component/field/HtmlEditor.js +0 -54
  381. data/app/assets/javascripts/src/layout/component/field/Slider.js +0 -58
  382. data/app/assets/javascripts/src/layout/component/field/Text.js +0 -75
  383. data/app/assets/javascripts/src/layout/component/field/TextArea.js +0 -51
  384. data/app/assets/javascripts/src/layout/component/field/Trigger.js +0 -132
  385. data/app/assets/javascripts/src/layout/container/Absolute.js +0 -121
  386. data/app/assets/javascripts/src/layout/container/Accordion.js +0 -308
  387. data/app/assets/javascripts/src/layout/container/Anchor.js +0 -403
  388. data/app/assets/javascripts/src/layout/container/Auto.js +0 -70
  389. data/app/assets/javascripts/src/layout/container/Border-old-js +0 -1079
  390. data/app/assets/javascripts/src/layout/container/Border.js +0 -816
  391. data/app/assets/javascripts/src/layout/container/Box.js +0 -929
  392. data/app/assets/javascripts/src/layout/container/Card.js +0 -361
  393. data/app/assets/javascripts/src/layout/container/CheckboxGroup.js +0 -376
  394. data/app/assets/javascripts/src/layout/container/Column.js +0 -234
  395. data/app/assets/javascripts/src/layout/container/Container.js +0 -961
  396. data/app/assets/javascripts/src/layout/container/Editor.js +0 -74
  397. data/app/assets/javascripts/src/layout/container/Fit.js +0 -287
  398. data/app/assets/javascripts/src/layout/container/Form.js +0 -157
  399. data/app/assets/javascripts/src/layout/container/HBox.js +0 -134
  400. data/app/assets/javascripts/src/layout/container/Table.js +0 -412
  401. data/app/assets/javascripts/src/layout/container/VBox.js +0 -139
  402. data/app/assets/javascripts/src/layout/container/boxOverflow/Menu.js +0 -365
  403. data/app/assets/javascripts/src/layout/container/boxOverflow/None.js +0 -83
  404. data/app/assets/javascripts/src/layout/container/boxOverflow/Scroller.js +0 -475
  405. data/app/assets/javascripts/src/menu/CheckItem.js +0 -169
  406. data/app/assets/javascripts/src/menu/ColorPicker.js +0 -110
  407. data/app/assets/javascripts/src/menu/DatePicker.js +0 -100
  408. data/app/assets/javascripts/src/menu/Item.js +0 -553
  409. data/app/assets/javascripts/src/menu/KeyNav.js +0 -134
  410. data/app/assets/javascripts/src/menu/Manager.js +0 -219
  411. data/app/assets/javascripts/src/menu/Menu.js +0 -579
  412. data/app/assets/javascripts/src/menu/Separator.js +0 -126
  413. data/app/assets/javascripts/src/panel/AbstractPanel.js +0 -323
  414. data/app/assets/javascripts/src/panel/DD.js +0 -99
  415. data/app/assets/javascripts/src/panel/Header.js +0 -518
  416. data/app/assets/javascripts/src/panel/Panel.js +0 -2150
  417. data/app/assets/javascripts/src/panel/Proxy.js +0 -131
  418. data/app/assets/javascripts/src/panel/Table.js +0 -1018
  419. data/app/assets/javascripts/src/panel/Tool.js +0 -304
  420. data/app/assets/javascripts/src/picker/Color.js +0 -219
  421. data/app/assets/javascripts/src/picker/Date.js +0 -1140
  422. data/app/assets/javascripts/src/picker/Month.js +0 -490
  423. data/app/assets/javascripts/src/picker/Time.js +0 -165
  424. data/app/assets/javascripts/src/resizer/BorderSplitter.js +0 -22
  425. data/app/assets/javascripts/src/resizer/BorderSplitterTracker.js +0 -210
  426. data/app/assets/javascripts/src/resizer/Handle.js +0 -29
  427. data/app/assets/javascripts/src/resizer/ResizeTracker.js +0 -346
  428. data/app/assets/javascripts/src/resizer/Resizer.js +0 -477
  429. data/app/assets/javascripts/src/resizer/Splitter.js +0 -242
  430. data/app/assets/javascripts/src/resizer/SplitterTracker.js +0 -230
  431. data/app/assets/javascripts/src/selection/CellModel.js +0 -395
  432. data/app/assets/javascripts/src/selection/CheckboxModel.js +0 -234
  433. data/app/assets/javascripts/src/selection/DataViewModel.js +0 -160
  434. data/app/assets/javascripts/src/selection/Model.js +0 -646
  435. data/app/assets/javascripts/src/selection/RowModel.js +0 -499
  436. data/app/assets/javascripts/src/selection/TreeModel.js +0 -78
  437. data/app/assets/javascripts/src/slider/Multi.js +0 -835
  438. data/app/assets/javascripts/src/slider/Single.js +0 -56
  439. data/app/assets/javascripts/src/slider/Thumb.js +0 -259
  440. data/app/assets/javascripts/src/slider/Tip.js +0 -130
  441. data/app/assets/javascripts/src/state/CookieProvider.js +0 -120
  442. data/app/assets/javascripts/src/state/LocalStorageProvider.js +0 -72
  443. data/app/assets/javascripts/src/state/Manager.js +0 -70
  444. data/app/assets/javascripts/src/state/Provider.js +0 -182
  445. data/app/assets/javascripts/src/state/Stateful.js +0 -364
  446. data/app/assets/javascripts/src/tab/Bar.js +0 -258
  447. data/app/assets/javascripts/src/tab/Panel.js +0 -654
  448. data/app/assets/javascripts/src/tab/Tab.js +0 -358
  449. data/app/assets/javascripts/src/tail.js +0 -10
  450. data/app/assets/javascripts/src/tip/QuickTip.js +0 -335
  451. data/app/assets/javascripts/src/tip/QuickTipManager.js +0 -239
  452. data/app/assets/javascripts/src/tip/Tip.js +0 -160
  453. data/app/assets/javascripts/src/tip/ToolTip.js +0 -691
  454. data/app/assets/javascripts/src/toolbar/Fill.js +0 -28
  455. data/app/assets/javascripts/src/toolbar/Item.js +0 -16
  456. data/app/assets/javascripts/src/toolbar/Paging.js +0 -600
  457. data/app/assets/javascripts/src/toolbar/Separator.js +0 -23
  458. data/app/assets/javascripts/src/toolbar/Spacer.js +0 -33
  459. data/app/assets/javascripts/src/toolbar/TextItem.js +0 -57
  460. data/app/assets/javascripts/src/toolbar/Toolbar-legacy.js +0 -123
  461. data/app/assets/javascripts/src/toolbar/Toolbar.js +0 -447
  462. data/app/assets/javascripts/src/tree/Column.js +0 -90
  463. data/app/assets/javascripts/src/tree/Panel.js +0 -505
  464. data/app/assets/javascripts/src/tree/View.js +0 -658
  465. data/app/assets/javascripts/src/tree/ViewDragZone.js +0 -49
  466. data/app/assets/javascripts/src/tree/ViewDropZone.js +0 -287
  467. data/app/assets/javascripts/src/tree/plugin/TreeViewDragDrop.js +0 -244
  468. data/app/assets/javascripts/src/util/AbstractMixedCollection.js +0 -772
  469. data/app/assets/javascripts/src/util/Animate.js +0 -426
  470. data/app/assets/javascripts/src/util/Bindable.js +0 -102
  471. data/app/assets/javascripts/src/util/CSS.js +0 -185
  472. data/app/assets/javascripts/src/util/ClickRepeater.js +0 -238
  473. data/app/assets/javascripts/src/util/ComponentDragger.js +0 -126
  474. data/app/assets/javascripts/src/util/Cookies.js +0 -91
  475. data/app/assets/javascripts/src/util/ElementContainer.js +0 -293
  476. data/app/assets/javascripts/src/util/Filter.js +0 -159
  477. data/app/assets/javascripts/src/util/Floating.js +0 -321
  478. data/app/assets/javascripts/src/util/Grouper.js +0 -26
  479. data/app/assets/javascripts/src/util/HashMap.js +0 -356
  480. data/app/assets/javascripts/src/util/History.js +0 -285
  481. data/app/assets/javascripts/src/util/Inflector.js +0 -297
  482. data/app/assets/javascripts/src/util/KeyMap.js +0 -427
  483. data/app/assets/javascripts/src/util/KeyNav.js +0 -239
  484. data/app/assets/javascripts/src/util/LruCache.js +0 -257
  485. data/app/assets/javascripts/src/util/Memento.js +0 -131
  486. data/app/assets/javascripts/src/util/MixedCollection.js +0 -239
  487. data/app/assets/javascripts/src/util/Observable.js +0 -1003
  488. data/app/assets/javascripts/src/util/Offset.js +0 -60
  489. data/app/assets/javascripts/src/util/Point.js +0 -93
  490. data/app/assets/javascripts/src/util/ProtoElement.js +0 -205
  491. data/app/assets/javascripts/src/util/Queue.js +0 -76
  492. data/app/assets/javascripts/src/util/Region.js +0 -388
  493. data/app/assets/javascripts/src/util/Renderable.js +0 -1079
  494. data/app/assets/javascripts/src/util/Sortable.js +0 -248
  495. data/app/assets/javascripts/src/util/Sorter.js +0 -179
  496. data/app/assets/javascripts/src/util/TextMetrics.js +0 -148
  497. data/app/assets/javascripts/src/view/AbstractView.js +0 -1103
  498. data/app/assets/javascripts/src/view/BoundList.js +0 -207
  499. data/app/assets/javascripts/src/view/BoundListKeyNav.js +0 -92
  500. data/app/assets/javascripts/src/view/DragZone.js +0 -106
  501. data/app/assets/javascripts/src/view/DropZone.js +0 -240
  502. data/app/assets/javascripts/src/view/Table.js +0 -1229
  503. data/app/assets/javascripts/src/view/TableChunker.js +0 -139
  504. data/app/assets/javascripts/src/view/View.js +0 -636
  505. data/app/assets/javascripts/src/window/MessageBox.js +0 -880
  506. data/app/assets/javascripts/src/window/Window-legacy.js +0 -56
  507. data/app/assets/javascripts/src/window/Window.js +0 -793
@@ -1,1229 +0,0 @@
1
- describe("Ext.Array", function() {
2
- var array;
3
-
4
- describe("Ext.Array.indexOf", function() {
5
- describe("without from argument", function() {
6
- beforeEach(function() {
7
- array = [1, 2, 3, 4, 5, 6];
8
- });
9
-
10
- afterEach(function(){
11
- array = null;
12
- });
13
-
14
- it("should always return -1 on an empty array", function(){
15
- expect(Ext.Array.indexOf([], 1)).toEqual(-1);
16
- });
17
-
18
- it("should return -1 if them it doesn't exist", function() {
19
- expect(Ext.Array.indexOf(array, 7)).toEqual(-1);
20
- });
21
-
22
- it("should return the matching index if found", function() {
23
- expect(Ext.Array.indexOf(array, 4)).toEqual(3);
24
- });
25
-
26
- it("should return the first matching index if found", function(){
27
- array.push(1);
28
- expect(Ext.Array.indexOf(array, 1)).toEqual(0);
29
- });
30
- });
31
-
32
- describe("with from argument", function() {
33
- beforeEach(function() {
34
- array = [1, 2, 3, 4, 5, 6, 7];
35
- });
36
-
37
- it("should return the matched index if found", function() {
38
- expect(Ext.Array.indexOf(array, 5, 3)).toEqual(4);
39
- expect(Ext.Array.indexOf(array, 5, 4)).toEqual(4);
40
- });
41
-
42
- it("should return -1 if the item doesn't exist after the passed from value", function() {
43
- expect(Ext.Array.indexOf(array, 5, 5)).toEqual(-1);
44
- });
45
- });
46
-
47
- });
48
- describe("removing items", function() {
49
- var myArray;
50
-
51
- it("should do nothing when removing from an empty array", function() {
52
- myArray = [];
53
-
54
- expect(function() {
55
- Ext.Array.remove(myArray, 1);
56
- }).not.toRaiseExtError();
57
-
58
- expect(myArray).toEqual([]);
59
- });
60
-
61
- describe("when removing an item inside an array", function() {
62
- beforeEach(function() {
63
- myArray = [1, 2, 3, 4, 5];
64
-
65
- Ext.Array.remove(myArray, 1);
66
- });
67
-
68
- it("should remove the item", function() {
69
- expect(myArray).toEqual([2, 3, 4, 5]);
70
- });
71
-
72
- it("should update the index of the following items", function() {
73
- expect(myArray[1]).toEqual(3);
74
- expect(myArray[2]).toEqual(4);
75
- expect(myArray[3]).toEqual(5);
76
- });
77
-
78
- it("should remove only using a strict type check", function(){
79
- Ext.Array.remove(myArray, '2');
80
- expect(myArray).toEqual([2, 3, 4, 5]);
81
- });
82
- });
83
- });
84
-
85
- describe("contains", function() {
86
- it("should always return false with an empty array", function(){
87
- expect(Ext.Array.contains([], 1)).toBe(false);
88
- });
89
-
90
- it("should return false if an item does not exist in the array", function() {
91
- expect(Ext.Array.contains([1, 2, 3], 10)).toBe(false);
92
- });
93
-
94
- it("should return true if an item exists in the array", function() {
95
- expect(Ext.Array.contains([8, 9, 10], 10)).toBe(true);
96
- });
97
-
98
- it("should only match with strict type checking", function(){
99
- expect(Ext.Array.contains([1, 2, 3, 4, 5], '1')).toBe(false);
100
- });
101
- });
102
-
103
- describe("include", function(){
104
- var myArray;
105
-
106
- it("should always add to an empty array", function(){
107
- myArray = [];
108
- Ext.Array.include(myArray, 1);
109
- expect(myArray).toEqual([1]);
110
- });
111
-
112
- it("should add the item if it doesn't exist", function(){
113
- myArray = [1];
114
- Ext.Array.include(myArray, 2);
115
- expect(myArray).toEqual([1, 2]);
116
- });
117
-
118
- it("should always add to the end of the array", function(){
119
- myArray = [9, 8, 7, 6];
120
- Ext.Array.include(myArray, 10);
121
- expect(myArray).toEqual([9, 8, 7, 6, 10]);
122
- });
123
-
124
- it("should match using strict type checking", function(){
125
- myArray = ['1'];
126
- Ext.Array.include(myArray, 1);
127
- expect(myArray).toEqual(['1', 1]);
128
- });
129
-
130
- it("should not modify the array if the value exists", function(){
131
- myArray = [4, 5, 6];
132
- Ext.Array.include(myArray, 7);
133
- expect(myArray).toEqual([4, 5, 6, 7]);
134
- });
135
- });
136
-
137
- describe("clone", function(){
138
- it("should clone an empty array to be empty", function(){
139
- expect(Ext.Array.clone([])).toEqual([]);
140
- });
141
-
142
- it("should clone an array with items", function(){
143
- expect(Ext.Array.clone([1, 3, 5])).toEqual([1, 3, 5]);
144
- });
145
-
146
- it("should create a new reference", function(){
147
- var arr = [1, 2, 3];
148
- expect(Ext.Array.clone(arr)).not.toBe(arr);
149
- });
150
-
151
- it("should do a shallow clone", function(){
152
- var o = {},
153
- arr = [o],
154
- result;
155
-
156
- result = Ext.Array.clone(arr);
157
- expect(result[0]).toBe(o);
158
- });
159
- });
160
-
161
- describe("clean", function(){
162
- it("should return an empty array if cleaning an empty array", function(){
163
- expect(Ext.Array.clean([])).toEqual([]);
164
- });
165
-
166
- it("should remove undefined values", function(){
167
- expect(Ext.Array.clean([undefined])).toEqual([]);
168
- });
169
-
170
- it("should remove null values", function(){
171
- expect(Ext.Array.clean([null])).toEqual([]);
172
- });
173
-
174
- it("should remove empty strings", function(){
175
- expect(Ext.Array.clean([''])).toEqual([]);
176
- });
177
-
178
- it("should remove empty arrays", function(){
179
- expect(Ext.Array.clean([[]])).toEqual([]);
180
- });
181
-
182
- it("should remove a mixture of empty values", function(){
183
- expect(Ext.Array.clean([null, undefined, '', []])).toEqual([]);
184
- });
185
-
186
- it("should remove all occurrences of empty values", function(){
187
- expect(Ext.Array.clean([null, null, null, undefined, '', '', '', undefined])).toEqual([]);
188
- });
189
-
190
- it("should leave non empty values untouched", function(){
191
- expect(Ext.Array.clean([1, 2, 3])).toEqual([1, 2, 3]);
192
- });
193
-
194
- it("should remove only the empty values", function(){
195
- expect(Ext.Array.clean([undefined, null, 1, null, 2])).toEqual([1, 2]);
196
- });
197
-
198
- it("should preserve order on removal", function(){
199
- expect(Ext.Array.clean([1, null, 2, null, null, null, 3, undefined, '', '', 4])).toEqual([1, 2, 3, 4]);
200
- });
201
- });
202
-
203
- describe("unique", function(){
204
-
205
- it("should return an empty array if run on an empty array", function(){
206
- expect(Ext.Array.unique([])).toEqual([]);
207
- });
208
-
209
- it("should return a new reference", function(){
210
- var arr = [1, 2, 3];
211
- expect(Ext.Array.unique(arr)).not.toBe(arr);
212
- });
213
-
214
- it("should return a copy if all items are unique", function(){
215
- expect(Ext.Array.unique([6, 7, 8])).toEqual([6, 7, 8]);
216
- });
217
-
218
- it("should only use strict typing to match", function(){
219
- expect(Ext.Array.unique([1, '1'])).toEqual([1, '1']);
220
- });
221
-
222
- it("should preserve the order when removing", function(){
223
- expect(Ext.Array.unique([1, 2, 1, 3, 1, 1, 1, 6, 5, 1])).toEqual([1, 2, 3, 6, 5]);
224
- });
225
- });
226
-
227
- describe("map", function(){
228
- var emptyFn = function(v){
229
- return v;
230
- };
231
-
232
- it("should return an empty array if run on an empty array", function(){
233
- expect(Ext.Array.map([], function(){})).toEqual([]);
234
- });
235
-
236
- it("should return a new reference", function(){
237
- var arr = [1, 2];
238
- expect(Ext.Array.map(arr, emptyFn)).not.toBe(arr);
239
- });
240
-
241
- it("should execute the function for each item in the array", function(){
242
- expect(Ext.Array.map([1, 2, 3, 4, 5], function(v){
243
- return v * 2;
244
- })).toEqual([2, 4, 6, 8, 10]);
245
- });
246
-
247
- it("should get called with the correct scope", function(){
248
- var scope = {},
249
- realScope;
250
- Ext.Array.map([1, 2, 3, 4, 5], function(){
251
- realScope = this;
252
- }, scope);
253
- expect(realScope).toBe(scope);
254
- });
255
-
256
- it("should get called with the argument, index and array", function(){
257
- var item,
258
- index,
259
- arr,
260
- data = [1];
261
-
262
- Ext.Array.map(data, function(){
263
- item = arguments[0];
264
- index = arguments[1];
265
- arr = arguments[2];
266
- });
267
- expect(item).toEqual(1);
268
- expect(index).toEqual(0);
269
- expect(arr).toBe(data);
270
- });
271
- });
272
-
273
- describe("from", function(){
274
- it("should return an empty array for an undefined value", function(){
275
- expect(Ext.Array.from(undefined)).toEqual([]);
276
- });
277
-
278
- it("should return an empty array for a null value", function(){
279
- expect(Ext.Array.from(null)).toEqual([]);
280
- });
281
-
282
- it("should convert an array", function(){
283
- expect(Ext.Array.from([1, 2, 3])).toEqual([1, 2, 3]);
284
- });
285
-
286
- it("should preserve the order", function(){
287
- expect(Ext.Array.from(['a', 'string', 'here'])).toEqual(['a', 'string', 'here']);
288
- });
289
-
290
- it("should convert a single value to an array", function(){
291
- expect(Ext.Array.from(true)).toEqual([true]);
292
- expect(Ext.Array.from(700)).toEqual([700]);
293
- });
294
-
295
- it("should convert arguments to an array", function(){
296
- var test, fn = function(){
297
- test = Ext.Array.from(arguments);
298
- };
299
- fn(1, 2, 3);
300
- expect(test instanceof Array).toBeTruthy();
301
- expect(test).toEqual([1, 2, 3]);
302
- });
303
-
304
- it("should convert a DOM collection to an array", function(){
305
- var ct = document.body.appendChild(document.createElement('div')),
306
- node1 = ct.appendChild(document.createElement('div')),
307
- node2 = ct.appendChild(document.createElement('div')),
308
- node3 = ct.appendChild(document.createElement('div')),
309
- collection = ct.getElementsByTagName('div'),
310
- result = Ext.Array.from(collection);
311
-
312
- expect(result instanceof Array).toBeTruthy();
313
- expect(result).toEqual([node1, node2, node3]);
314
- document.body.removeChild(ct);
315
- });
316
-
317
- it("should convert a single string", function(){
318
- expect(Ext.Array.from('Foo')).toEqual(['Foo']);
319
- });
320
-
321
- it("should convert a single string", function(){
322
- var fn = function(){};
323
- expect(Ext.Array.from(fn)).toEqual([fn]);
324
- });
325
- });
326
-
327
- describe("toArray", function(){
328
- it("should convert an array", function(){
329
- expect(Ext.Array.toArray([1, 2, 3, 4])).toEqual([1, 2, 3, 4]);
330
- });
331
-
332
- it("should convert a string", function(){
333
- expect(Ext.Array.toArray('12345')).toEqual(['1', '2', '3', '4', '5']);
334
- });
335
-
336
- it("should create a new reference", function(){
337
- var arr = [6, 7, 8];
338
- expect(Ext.Array.toArray(arr)).not.toBe(arr);
339
- });
340
-
341
- it("should convert arguments", function(){
342
- var test, fn = function(){
343
- test = Ext.Array.toArray(arguments);
344
- };
345
- fn(-1, -2, -3);
346
- expect(test instanceof Array).toBeTruthy();
347
- expect(test).toEqual([-1, -2, -3]);
348
- });
349
-
350
- it("should convert a DOM collection", function(){
351
- var ct = document.body.appendChild(document.createElement('div')),
352
- node1 = ct.appendChild(document.createElement('div')),
353
- node2 = ct.appendChild(document.createElement('div')),
354
- node3 = ct.appendChild(document.createElement('div')),
355
- collection = ct.getElementsByTagName('div'),
356
- result = Ext.Array.toArray(collection);
357
-
358
- expect(result instanceof Array).toBeTruthy();
359
- expect(result).toEqual([node1, node2, node3]);
360
- document.body.removeChild(ct);
361
- });
362
-
363
- describe("start/end parameters", function(){
364
- it("should default to whole of the array", function(){
365
- expect(Ext.Array.toArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
366
- });
367
-
368
- it("should work with only the start parameter specified", function(){
369
- expect(Ext.Array.toArray([1, 2, 3, 4, 5, 6], 2)).toEqual([3, 4, 5, 6]);
370
- });
371
-
372
- it("should work with only the end parameter specified", function(){
373
- expect(Ext.Array.toArray([1, 2, 3, 4, 5, 6], null, 4)).toEqual([1, 2, 3, 4]);
374
- });
375
-
376
- it("should work with both params specified", function(){
377
- expect(Ext.Array.toArray([1, 2, 3, 4, 5, 6], 2, 4)).toEqual([3, 4]);
378
- });
379
-
380
- it("should work with nagative end", function(){
381
- expect(Ext.Array.toArray([1, 2, 3, 4, 5, 6], 2, -1)).toEqual([3, 4, 5]);
382
- });
383
- });
384
- });
385
-
386
- describe("pluck", function(){
387
- it("should return an empty array when an empty array is passed", function(){
388
- expect(Ext.Array.pluck([], 'prop')).toEqual([]);
389
- });
390
-
391
- it("should pull the properties from objects in the array", function(){
392
- var arr = [{prop: 1}, {prop: 2}, {prop: 3}];
393
- expect(Ext.Array.pluck(arr, 'prop')).toEqual([1, 2, 3]);
394
- });
395
-
396
- it("should return a new reference", function(){
397
- var arr = [{prop: 1}, {prop: 2}, {prop: 3}];
398
- expect(Ext.Array.pluck(arr, 'prop')).not.toBe(arr);
399
- });
400
-
401
- it("should work on a DOM collection", function(){
402
- var ct = document.body.appendChild(document.createElement('div')),
403
- i = 0,
404
- node;
405
-
406
- for(; i < 5; ++i) {
407
- node = ct.appendChild(document.createElement('div'));
408
- node.className = 'node' + i;
409
- }
410
-
411
- expect(Ext.Array.pluck(ct.getElementsByTagName('div'), 'className')).toEqual(['node0', 'node1', 'node2', 'node3', 'node4']);
412
- document.body.removeChild(ct);
413
- });
414
- });
415
-
416
- describe("filter", function(){
417
- var trueFn = function(){
418
- return true;
419
- };
420
-
421
- it("should return an empty array if filtering an empty array", function(){
422
- expect(Ext.Array.filter([], trueFn)).toEqual([]);
423
- });
424
-
425
- it("should create a new reference", function(){
426
- var arr = [1, 2, 3];
427
- expect(Ext.Array.filter(arr, trueFn)).not.toBe(arr);
428
- });
429
-
430
- it("should add items if the filter function returns true", function(){
431
- expect(Ext.Array.filter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(val){
432
- return val % 2 === 0;
433
- })).toEqual([2, 4, 6, 8, 10]);
434
- });
435
-
436
- it("should add items if the filter function returns a truthy value", function(){
437
- expect(Ext.Array.filter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(val){
438
- if (val % 2 === 0) {
439
- return 1;
440
- }
441
- })).toEqual([2, 4, 6, 8, 10]);
442
- });
443
-
444
- it("should not add items if the filter function returns a falsy value", function(){
445
- expect(Ext.Array.filter([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(val){
446
- return 0;
447
- })).toEqual([]);
448
- });
449
-
450
- it("should pass the correct parameters", function(){
451
- var values = [],
452
- indexes = [],
453
- arrs = [],
454
- data = [1, 2, 3];
455
-
456
- Ext.Array.filter([1, 2, 3], function(val, index, arr){
457
- values.push(val);
458
- indexes.push(index);
459
- arrs.push(arr);
460
- });
461
-
462
- expect(values).toEqual([1, 2, 3]);
463
- expect(indexes).toEqual([0, 1, 2]);
464
- expect(arrs).toEqual([data, data, data]);
465
- });
466
-
467
- it("should do a shallow copy", function(){
468
- var o1 = {prop: 1},
469
- o2 = {prop: 2},
470
- o3 = {prop: 3};
471
-
472
- expect(Ext.Array.filter([o1, o2, o3], trueFn)).toEqual([o1, o2, o3]);
473
- });
474
-
475
- it("should execute in scope when passed", function(){
476
- var scope = {},
477
- actual;
478
-
479
- expect(Ext.Array.filter([1, 2, 3], function(){
480
- actual = this;
481
- }, scope));
482
- expect(actual).toBe(scope);
483
- });
484
- });
485
-
486
- describe("forEach", function(){
487
- it("should not execute on an empty array", function(){
488
- var count = 0;
489
- Ext.Array.forEach([], function(){
490
- ++count;
491
- });
492
- expect(count).toEqual(0);
493
- });
494
-
495
- it("should execute for each item in the array", function(){
496
- var count = 0;
497
- Ext.Array.forEach([1, 2, 3, 4, 5], function(){
498
- ++count;
499
- });
500
- expect(count).toEqual(5);
501
- });
502
-
503
- it("should execute in the appropriate scope", function(){
504
- var scope = {},
505
- actual;
506
-
507
- Ext.Array.forEach([1, 2, 3], function(){
508
- actual = this;
509
- }, scope);
510
-
511
- expect(actual).toBe(scope);
512
- });
513
-
514
- it("should pass the appropriate params to the callback", function(){
515
- var values = [],
516
- indexes = [],
517
- arrs = [],
518
- data = [1, 2, 3];
519
-
520
- Ext.Array.forEach(data, function(val, index, arr){
521
- values.push(val);
522
- indexes.push(index);
523
- arrs.push(arr);
524
- });
525
-
526
- expect(values).toEqual([1, 2, 3]);
527
- expect(indexes).toEqual([0, 1, 2]);
528
- expect(arrs).toEqual([data, data, data]);
529
- });
530
- });
531
-
532
- describe("each", function(){
533
- describe("return values", function(){
534
- xit("should return 0 if the passed value is empty", function(){
535
- expect(Ext.Array.each([])).toEqual(0);
536
- });
537
-
538
- it("should return the stopping index if iteration is halted", function(){
539
- expect(Ext.Array.each([1, 2, 3], function(val){
540
- return val != 2;
541
- })).toEqual(1);
542
- });
543
-
544
- it("should return true if iteration is not stopped", function(){
545
- expect(Ext.Array.each([4, 5, 6], function(){
546
- return true;
547
- })).toBeTruthy();
548
- });
549
- });
550
-
551
- describe("scope/parameters", function(){
552
- it("should execute in the specified scope", function(){
553
- var scope = {},
554
- actual;
555
-
556
- Ext.Array.each([1, 2, 3], function(){
557
- actual = this;
558
- }, scope);
559
- expect(actual).toBe(scope);
560
- });
561
-
562
- it("should pass the item, index and array", function(){
563
- var values = [],
564
- indexes = [],
565
- arrs = [],
566
- data = [1, 2, 3];
567
-
568
- Ext.Array.each(data, function(val, index, arr){
569
- values.push(val);
570
- indexes.push(index);
571
- arrs.push(arr);
572
- });
573
-
574
- expect(values).toEqual([1, 2, 3]);
575
- expect(indexes).toEqual([0, 1, 2]);
576
- expect(arrs).toEqual([data, data, data]);
577
- });
578
- });
579
-
580
- describe("stopping iteration", function(){
581
- it("should not stop iteration by default", function(){
582
- var count = 0;
583
- Ext.Array.each([1, 2, 3, 4, 5], function(){
584
- ++count;
585
- });
586
- expect(count).toEqual(5);
587
- });
588
-
589
- it("should not stop unless an explicit false is returned", function(){
590
- var count = 0;
591
- Ext.Array.each([1, 2, 3, 4, 5], function(){
592
- ++count;
593
- return null;
594
- });
595
- expect(count).toEqual(5);
596
- });
597
-
598
- it("should stop immediately if false is returned", function(){
599
- var count = 0;
600
- Ext.Array.each([1, 2, 3, 4, 5], function(v){
601
- ++count;
602
- return v != 2;
603
- });
604
- expect(count).toEqual(2);
605
- });
606
- });
607
-
608
- describe("other collection types", function(){
609
- it("should iterate arguments", function(){
610
- var test, values = [], fn = function(){
611
- test = Ext.Array.each(arguments, function(val){
612
- values.push(val);
613
- });
614
- };
615
- fn(1, 2, 3);
616
- expect(values).toEqual([1, 2, 3]);
617
- });
618
-
619
- it("should iterate over a DOM collection", function(){
620
- var ct = document.body.appendChild(document.createElement('div')),
621
- node1 = ct.appendChild(document.createElement('div')),
622
- node2 = ct.appendChild(document.createElement('div')),
623
- node3 = ct.appendChild(document.createElement('div')),
624
- collection = ct.getElementsByTagName('div'),
625
- result = [];
626
-
627
- Ext.Array.each(collection, function(node){
628
- result.push(node.tagName.toLowerCase());
629
- });
630
-
631
- expect(result).toEqual(['div', 'div', 'div']);
632
- document.body.removeChild(ct);
633
- });
634
- });
635
-
636
- it("should iterate once over a single, non empty value", function(){
637
- var count = 0;
638
- Ext.Array.each('string', function(){
639
- ++count;
640
- });
641
- expect(count).toEqual(1);
642
- });
643
-
644
- describe("reverse iteraction", function() {
645
- it("should iterate backwards", function() {
646
- var output = [],
647
- input = [1, 2, 3],
648
- fn = function(number) {
649
- output.push(number);
650
- };
651
- Ext.Array.each(input, fn, undefined, true);
652
- expect(output).toEqual([3, 2, 1]);
653
- });
654
- it("should iterate backwards and stop when fn returns false", function() {
655
- var output = [],
656
- input = [1, 2, 3],
657
- fn = function(number) {
658
- output.push(number);
659
- if (number === 2) { return false; }
660
- };
661
- Ext.Array.each(input, fn, undefined, true);
662
- expect(output).toEqual([3, 2]);
663
- });
664
- });
665
- });
666
-
667
- describe("every", function(){
668
- describe("scope/params", function(){
669
- it("should execute in the specified scope", function(){
670
- var scope = {},
671
- actual;
672
-
673
- Ext.Array.every([1, 2, 3], function(){
674
- actual = this;
675
- }, scope);
676
- expect(actual).toBe(scope);
677
- });
678
-
679
- it("should pass the item, index and array", function(){
680
- var values = [],
681
- indexes = [],
682
- arrs = [],
683
- data = [1, 2, 3];
684
-
685
- Ext.Array.every(data, function(val, index, arr){
686
- values.push(val);
687
- indexes.push(index);
688
- arrs.push(arr);
689
- return true;
690
- });
691
-
692
- expect(values).toEqual([1, 2, 3]);
693
- expect(indexes).toEqual([0, 1, 2]);
694
- expect(arrs).toEqual([data, data, data]);
695
- });
696
- });
697
-
698
- it("should return true on an empty array", function(){
699
- expect(Ext.Array.every([], function(){})).toBeTruthy();
700
- });
701
-
702
- it("should throw an exception if no fn is passed", function(){
703
- expect(function(){
704
- Ext.Array.every([1, 2, 3]);
705
- }).toRaiseExtError();
706
- });
707
-
708
- it("should stop as soon as a false value is found", function(){
709
- var count = 0,
710
- result;
711
-
712
- result = Ext.Array.every([true, true, false, true], function(v){
713
- ++count;
714
- return v;
715
- });
716
- expect(count).toEqual(3);
717
- expect(result).toBeFalsy();
718
- });
719
-
720
- it("should return true if all values match the function", function(){
721
- expect(Ext.Array.every([1, 2, 3, 4, 5, 6, 7, 8, 9], function(v){
722
- return v < 10;
723
- })).toBeTruthy();
724
- });
725
- });
726
-
727
- describe("some", function(){
728
- describe("scope/params", function(){
729
- it("should execute in the specified scope", function(){
730
- var scope = {},
731
- actual;
732
-
733
- Ext.Array.some([1, 2, 3], function(){
734
- actual = this;
735
- }, scope);
736
- expect(actual).toBe(scope);
737
- });
738
-
739
- it("should pass the item, index and array", function(){
740
- var values = [],
741
- indexes = [],
742
- arrs = [],
743
- data = [1, 2, 3];
744
-
745
- Ext.Array.some(data, function(val, index, arr){
746
- values.push(val);
747
- indexes.push(index);
748
- arrs.push(arr);
749
- return true;
750
- });
751
-
752
- expect(values).toEqual([1]);
753
- expect(indexes).toEqual([0]);
754
- expect(arrs).toEqual([data]);
755
- });
756
- });
757
-
758
- it("should return false on an empty array", function(){
759
- expect(Ext.Array.some([], function(){})).toBeFalsy();
760
- });
761
-
762
- it("should throw an exception if no fn is passed", function(){
763
- expect(function(){
764
- Ext.Array.some([1, 2, 3]);
765
- }).toRaiseExtError();
766
- });
767
-
768
- it("should stop as soon as a matching value is found", function(){
769
- var count = 0,
770
- result;
771
-
772
- result = Ext.Array.some([1, 2, 3, 4], function(val){
773
- ++count;
774
- return val == 3;
775
- });
776
- expect(count).toEqual(3);
777
- expect(result).toBeTruthy();
778
- });
779
-
780
- it("should return false if nothing matches the matcher function", function(){
781
- var count = 0,
782
- result;
783
-
784
- result = Ext.Array.some([1, 2, 3, 4, 5, 6, 7, 8, 9], function(val){
785
- ++count;
786
- return val > 9;
787
- });
788
- expect(count).toEqual(9);
789
- expect(result).toBeFalsy();
790
- });
791
- });
792
-
793
- describe("merge", function(){
794
- it("should return an empty array if run on an empty array", function(){
795
- expect(Ext.Array.merge([])).toEqual([]);
796
- });
797
-
798
- it("should return a new reference", function(){
799
- var arr = [1, 2, 3];
800
- expect(Ext.Array.merge(arr)).not.toBe(arr);
801
- });
802
-
803
- it("should return a copy if all items are unique", function(){
804
- expect(Ext.Array.merge([6, 7, 8])).toEqual([6, 7, 8]);
805
- });
806
-
807
- it("should only use strict typing to match", function(){
808
- expect(Ext.Array.merge([1, '1'])).toEqual([1, '1']);
809
- });
810
-
811
- it("should accept two or more arrays and return a unique union with items in order of first appearance", function(){
812
- expect(Ext.Array.merge([1, 2, 3], ['1', '2', '3'], [4, 1, 5, 2], [6, 3, 7, '1'], [8, '2', 9, '3'])).toEqual([1, 2, 3, '1', '2', '3', 4, 5, 6, 7, 8, 9]);
813
- });
814
- });
815
-
816
- describe("intersect", function(){
817
- it("should return an empty array if no arrays are passed", function(){
818
- expect(Ext.Array.intersect()).toEqual([]);
819
- });
820
-
821
- it("should return an empty array if one empty array is passed", function(){
822
- expect(Ext.Array.intersect([])).toEqual([]);
823
- });
824
-
825
- it("should return a new reference", function(){
826
- var arr = [1, 2, 3];
827
- expect(Ext.Array.intersect(arr)).not.toBe(arr);
828
- });
829
-
830
- it("should return a copy if one array is passed", function(){
831
- expect(Ext.Array.intersect([6, 7, 8])).toEqual([6, 7, 8]);
832
- });
833
-
834
- it("should return an intersection of two or more arrays with items in order of first appearance", function(){
835
- expect(Ext.Array.intersect([1, 2, 3], [4, 3, 2, 5], [2, 6, 3])).toEqual([2, 3]);
836
- });
837
-
838
- it("should return an empty array if there is no intersecting values", function(){
839
- expect(Ext.Array.intersect([1, 2, 3], [4, 5, 6])).toEqual([]);
840
- });
841
-
842
- it("should contain the unique set of intersected values only", function(){
843
- expect(Ext.Array.intersect([1, 1, 2, 3, 3], [1, 1, 2, 3, 3])).toEqual([1, 2, 3]);
844
- });
845
-
846
- it("should only use strict typing to match", function(){
847
- expect(Ext.Array.intersect([1], ['1'])).toEqual([]);
848
- });
849
- it("should handle arrays containing falsy values", function() {
850
- expect(Ext.Array.intersect([undefined, null, false, 0, ''], [undefined, null, false, 0, ''])).toEqual([undefined, null, false, 0, '']);
851
- });
852
- });
853
-
854
- describe("difference", function(){
855
- it("should return a set difference of two arrays with items in order of first appearance", function(){
856
- expect(Ext.Array.difference([1, 2, 3, 4], [3, 2])).toEqual([1, 4]);
857
- });
858
-
859
- it("should return the first array unchanged if there is no difference", function(){
860
- expect(Ext.Array.difference([1, 2, 3], [4, 5, 6])).toEqual([1, 2, 3]);
861
- });
862
-
863
- it("should return a new reference", function(){
864
- var arr = [1, 2, 3];
865
- expect(Ext.Array.difference(arr, [3, 2])).not.toBe(arr);
866
- });
867
-
868
- it("should remove multiples of the same value from the first array", function(){
869
- expect(Ext.Array.difference([1, 2, 3, 2, 4, 1], [2, 1])).toEqual([3, 4]);
870
- });
871
-
872
- it("should only use strict typing to match", function(){
873
- expect(Ext.Array.difference([1], ['1'])).toEqual([1]);
874
- });
875
- });
876
-
877
- describe("sort", function() {
878
- var sarray, narray;
879
- beforeEach(function() {
880
- sarray = ['bbb', 'addda', 'erere', 'fff', 'de3'];
881
- narray = [1,3,2,4,6,7];
882
-
883
- });
884
-
885
- describe("with strings", function() {
886
- it("should be able to sort an array without sortFn", function() {
887
- Ext.Array.sort(sarray);
888
- expect(sarray).toEqual(['addda', 'bbb', 'de3', 'erere', 'fff']);
889
- });
890
-
891
-
892
- it("should be able to use a sortFn that returns a Number", function() {
893
- Ext.Array.sort(sarray, function(a,b){
894
- if (a === b) {
895
- return 0;
896
- }
897
- return a > b ? 1: -1;
898
- });
899
- expect(sarray).toEqual(['addda', 'bbb', 'de3', 'erere', 'fff']);
900
- });
901
- });
902
-
903
- describe("with numbers", function() {
904
- it("should be able to sort an array without sortFn", function() {
905
- Ext.Array.sort(narray);
906
- expect(narray).toEqual([1,2,3,4,6,7]);
907
- });
908
-
909
-
910
- it("should be able to use a sortFn that returns a Number", function() {
911
- Ext.Array.sort(narray, function(a,b){
912
- return a - b;
913
- });
914
- expect(narray).toEqual([1,2,3,4,6,7]);
915
- });
916
- });
917
- });
918
-
919
- describe("min", function() {
920
- describe("numbers", function() {
921
- it("without comparisonFn", function() {
922
- expect(Ext.Array.min([1,2,3,4,5,6])).toEqual(1);
923
- expect(Ext.Array.min([6,5,4,3,2,1])).toEqual(1);
924
- });
925
-
926
- it("with comparisonFn", function() {
927
- expect(Ext.Array.min([1,2,3,4,5,6], function(a, b) { return a < b ? 1 : -1; })).toEqual(6);
928
- });
929
- });
930
- });
931
-
932
- describe("max", function() {
933
- describe("numbers", function() {
934
- it("without comparisonFn", function() {
935
- expect(Ext.Array.max([1,2,3,4,5,6])).toEqual(6);
936
- });
937
-
938
- it("with comparisonFn", function() {
939
- expect(Ext.Array.max([1,2,3,4,5,6], function(a, b) { return a < b ? 1 : -1; })).toEqual(1);
940
- });
941
- });
942
- });
943
-
944
- describe("sum", function() {
945
- it("should return 21", function() {
946
- expect(Ext.Array.sum([1,2,3,4,5,6])).toEqual(21);
947
- });
948
- });
949
-
950
- describe("mean", function() {
951
- it("should return 3.5", function() {
952
- expect(Ext.Array.mean([1,2,3,4,5,6])).toEqual(3.5);
953
- });
954
- });
955
-
956
- function testReplace (replace) {
957
- it('should remove items in the middle', function () {
958
- var array = [0, 1, 2, 3, 4, 5, 6, 7];
959
- replace(array, 2, 2);
960
- expect(Ext.encode(array)).toEqual('[0,1,4,5,6,7]');
961
- });
962
- it('should insert items in the middle', function () {
963
- var array = [0, 1, 2, 3, 4, 5, 6, 7];
964
- replace(array, 2, 0, ['a','b']);
965
- expect(Ext.encode(array)).toEqual('[0,1,"a","b",2,3,4,5,6,7]');
966
- });
967
- it('should replace in the middle with more items', function () {
968
- var array = [0, 1, 2, 3, 4, 5, 6, 7];
969
- replace(array, 2, 2, ['a','b', 'c', 'd']);
970
- expect(Ext.encode(array)).toEqual('[0,1,"a","b","c","d",4,5,6,7]');
971
- });
972
- it('should replace in the middle with fewer items', function () {
973
- var array = [0, 1, 2, 3, 4, 5, 6, 7];
974
- replace(array, 2, 4, ['a','b']);
975
- expect(Ext.encode(array)).toEqual('[0,1,"a","b",6,7]');
976
- });
977
- it('should delete at front', function () {
978
- var array = [0, 1, 2, 3];
979
- replace(array, 0, 2);
980
- expect(Ext.encode(array)).toEqual('[2,3]');
981
- });
982
- it('should delete at tail', function () {
983
- var array = [0, 1, 2, 3];
984
- replace(array, 2, 2);
985
- expect(Ext.encode(array)).toEqual('[0,1]');
986
- });
987
- it('should delete everything', function () {
988
- var array = [0, 1, 2, 3];
989
- replace(array, 0, 4);
990
- expect(Ext.encode(array)).toEqual('[]');
991
- });
992
- it('should insert at front', function () {
993
- var array = [0, 1];
994
- replace(array, 0, 0, ['a','b','c','d','e']);
995
- expect(Ext.encode(array)).toEqual('["a","b","c","d","e",0,1]');
996
- });
997
- it('should insert at tail', function () {
998
- var array = [0, 1];
999
- replace(array, array.length, 0, ['a','b','c','d','e']);
1000
- expect(Ext.encode(array)).toEqual('[0,1,"a","b","c","d","e"]');
1001
- });
1002
- it('should insert into empty array', function () {
1003
- var array = [];
1004
- replace(array, 0, 0, ['a','b','c','d','e']);
1005
- expect(Ext.encode(array)).toEqual('["a","b","c","d","e"]');
1006
- });
1007
- it('should replace at front', function () {
1008
- var array = [0, 1];
1009
- replace(array, 0, 1, ['a','b','c','d','e']);
1010
- expect(Ext.encode(array)).toEqual('["a","b","c","d","e",1]');
1011
- });
1012
- it('should replace at tail', function () {
1013
- var array = [0, 1];
1014
- replace(array, 1, 1, ['a','b','c','d','e']);
1015
- expect(Ext.encode(array)).toEqual('[0,"a","b","c","d","e"]');
1016
- });
1017
- it('should replace entire array', function () {
1018
- var array = [0, 1, 2, 3];
1019
- replace(array, 0, array.length, ['a','b','c','d','e']);
1020
- expect(Ext.encode(array)).toEqual('["a","b","c","d","e"]');
1021
- });
1022
- it('should handle negative index', function () {
1023
- var array = [0, 1, 2, 3];
1024
- replace(array, -2, 20); // should clip
1025
- expect(Ext.encode(array)).toEqual('[0,1]');
1026
- });
1027
- it('should work around the IE8 bug', function () {
1028
- // see http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/6e946d03-e09f-4b22-a4dd-cd5e276bf05a/
1029
- var array = [],
1030
- lengthBefore,
1031
- j = 20;
1032
-
1033
- while (j--) {
1034
- array.push("A");
1035
- }
1036
-
1037
- array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
1038
- // the fact that this is an APPLY is not instrumental to reproducing this bug
1039
-
1040
- lengthBefore = array.length; // = 41
1041
-
1042
- // everything above should be exactly preserved including the true splice call.
1043
- // That way we have produced the Array Time Bomb... now see if it explodes!
1044
-
1045
- replace(array, 13, 0, ["XXX"]); // add one element (this was the failure)
1046
-
1047
- expect(array.length).toEqual(lengthBefore+1);
1048
- });
1049
- }
1050
-
1051
- describe('replaceSim', function () {
1052
- // The _replace method is our corrected method for IE8, but we make it available (in
1053
- // debug builds) on all browsers to see that it works.
1054
- testReplace(Ext.Array._replaceSim);
1055
- });
1056
-
1057
- describe('replaceNative', function () {
1058
- // and test the wrapper on other browsers
1059
- testReplace(Ext.Array.replace);
1060
- });
1061
-
1062
- describe('splice', function () {
1063
- it('returns proper result array at the front', function () {
1064
- var ret = Ext.Array._spliceSim([1,2,3,4], 0, 2);
1065
- expect(Ext.encode(ret)).toEqual('[1,2]');
1066
- });
1067
- it('returns proper result array at the end', function () {
1068
- var ret = Ext.Array._spliceSim([1,2,3,4], 2, 2);
1069
- expect(Ext.encode(ret)).toEqual('[3,4]');
1070
- });
1071
- it('returns proper result array from the middle', function () {
1072
- var ret = Ext.Array._spliceSim([1,2,3,4], 1, 2);
1073
- expect(Ext.encode(ret)).toEqual('[2,3]');
1074
- });
1075
- it('return an empty array when nothing removed', function () {
1076
- var ret = Ext.Array._spliceSim([1,2,3,4], 1, 0);
1077
- expect(Ext.encode(ret)).toEqual('[]');
1078
- });
1079
- });
1080
-
1081
- describe('slice', function(){
1082
-
1083
- var array;
1084
-
1085
- describe('with Array', function(){
1086
- beforeEach(function(){
1087
- array = [{0:0}, {1:1}, {2:2}, {3:3}];
1088
- });
1089
- tests();
1090
- });
1091
-
1092
- describe('with arguments', function(){
1093
- beforeEach(function(){
1094
- array = (function(){ return arguments; })({0:0}, {1:1}, {2:2}, {3:3});
1095
- });
1096
- tests();
1097
- });
1098
-
1099
- function tests(){
1100
- it('should shallow clone', function(){
1101
- var newArray = Ext.Array.slice(array, 0);
1102
- expect(newArray === array).toBe(false);
1103
- expect(newArray[0] === array[0]).toBe(true);
1104
- });
1105
- it('should not require a begin or end', function(){
1106
- var newArray = Ext.Array.slice(array);
1107
- expect(newArray === array).toBe(false);
1108
- expect(newArray[0]).toBe(array[0]);
1109
- });
1110
- it('should slice off the first item', function(){
1111
- var newArray = Ext.Array.slice(array, 1);
1112
- expect(newArray.length).toBe(3);
1113
- expect(newArray[0]).toBe(array[1]);
1114
- expect(newArray[2]).toBe(array[3]);
1115
- });
1116
- it('should ignore `end` if undefined', function(){
1117
- var newArray = Ext.Array.slice(array, 1, undefined);
1118
- expect(newArray.length).toBe(3);
1119
- expect(newArray[0]).toBe(array[1]);
1120
- expect(newArray[2]).toBe(array[3]);
1121
- });
1122
- it('should ignore `begin` if undefined', function(){
1123
- var newArray = Ext.Array.slice(array, undefined);
1124
- expect(newArray.length).toBe(4);
1125
- expect(newArray[0]).toBe(array[0]);
1126
- expect(newArray[3]).toBe(array[3]);
1127
- });
1128
- it('should ignore `begin` and `end` if undefined', function(){
1129
- var newArray = Ext.Array.slice(array, undefined, undefined);
1130
- expect(newArray.length).toBe(4);
1131
- expect(newArray[0]).toBe(array[0]);
1132
- expect(newArray[3]).toBe(array[3]);
1133
- });
1134
- it('should slice out the middle', function(){
1135
- var newArray = Ext.Array.slice(array, 1, -1);
1136
- expect(newArray.length).toBe(2);
1137
- expect(newArray[0]).toBe(array[1]);
1138
- expect(newArray[1]).toBe(array[2]);
1139
- });
1140
- }
1141
- });
1142
-
1143
- describe('toMap', function () {
1144
- it('should handle just an array', function () {
1145
- var map = Ext.Array.toMap(['a','b','c']);
1146
-
1147
- expect(map.a).toEqual(1);
1148
- expect(map.b).toEqual(2);
1149
- expect(map.c).toEqual(3);
1150
-
1151
- delete map.a;
1152
- delete map.b;
1153
- delete map.c;
1154
-
1155
- expect(Ext.encode(map)).toEqual('{}');
1156
- });
1157
- it('should handle just an array and a property name', function () {
1158
- var map = Ext.Array.toMap([
1159
- { name: 'aaa' },
1160
- { name: 'bbb' },
1161
- { name: 'ccc' }
1162
- ], 'name');
1163
-
1164
- expect(map.aaa).toEqual(1);
1165
- expect(map.bbb).toEqual(2);
1166
- expect(map.ccc).toEqual(3);
1167
-
1168
- delete map.aaa;
1169
- delete map.bbb;
1170
- delete map.ccc;
1171
-
1172
- expect(Ext.encode(map)).toEqual('{}');
1173
- });
1174
- it('should handle just an array and a key extractor', function () {
1175
- var map = Ext.Array.toMap([
1176
- { name: 'aaa' },
1177
- { name: 'bbb' },
1178
- { name: 'ccc' }
1179
- ], function (obj) {
1180
- return obj.name.toUpperCase();
1181
- });
1182
-
1183
- expect(map.AAA).toEqual(1);
1184
- expect(map.BBB).toEqual(2);
1185
- expect(map.CCC).toEqual(3);
1186
-
1187
- delete map.AAA;
1188
- delete map.BBB;
1189
- delete map.CCC;
1190
-
1191
- expect(Ext.encode(map)).toEqual('{}');
1192
- });
1193
- });
1194
-
1195
- describe('flatten', function() {
1196
- var flatten = Ext.Array.flatten;
1197
- it('should convert a multi-dimensional array into 1-d array', function() {
1198
- expect(flatten([
1199
- 1,
1200
- [2,3],
1201
- [4,[5,6]]
1202
- ])).toEqual([1,2,3,4,5,6]);
1203
- });
1204
- });
1205
-
1206
- describe("Ext.Array.push", function() {
1207
- var push = Ext.Array.push;
1208
-
1209
- it("should create an array", function(){
1210
- expect(push(undefined, 1)).toEqual([1]);
1211
- });
1212
-
1213
- it("should convert a non-array to an array", function() {
1214
- expect(push(1, 2)).toEqual([1, 2]);
1215
- });
1216
-
1217
- it("should push single elements onto end", function() {
1218
- expect(push([1, 2], 3, 4, 5)).toEqual([1, 2, 3, 4, 5]);
1219
- });
1220
-
1221
- it("should push all items of array arguments onto end", function(){
1222
- expect(push([1, 2], [3, 4], [5])).toEqual([1, 2, 3, 4, 5]);
1223
- });
1224
-
1225
- it("should push arrays and single items into the end", function(){
1226
- expect(push([1, 2], [3, 4], 5)).toEqual([1, 2, 3, 4, 5]);
1227
- });
1228
- });
1229
- });