sproutcore 1.7.1.beta → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. data/CHANGELOG +44 -0
  2. data/README.rdoc +20 -20
  3. data/VERSION.yml +3 -3
  4. data/lib/Buildfile +1 -1
  5. data/lib/buildtasks/build.rake +5 -0
  6. data/lib/buildtasks/manifest.rake +19 -1
  7. data/lib/frameworks/sproutcore/Buildfile +19 -17
  8. data/lib/frameworks/sproutcore/CHANGELOG.md +163 -29
  9. data/lib/frameworks/sproutcore/README.md +29 -8
  10. data/lib/frameworks/sproutcore/apps/statechart_routing/Buildfile +12 -0
  11. data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/login_controller.js +11 -0
  12. data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/main_controller.js +7 -0
  13. data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/statechart_controller.js +17 -0
  14. data/lib/frameworks/sproutcore/apps/statechart_routing/core.js +25 -0
  15. data/lib/frameworks/sproutcore/apps/statechart_routing/main.js +15 -0
  16. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/_theme.css +18 -0
  17. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/bar_page.js +14 -0
  18. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/foo_page.js +14 -0
  19. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/loading.rhtml +9 -0
  20. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/login_page.js +61 -0
  21. data/lib/frameworks/sproutcore/apps/statechart_routing/resources/main_page.js +46 -0
  22. data/lib/frameworks/sproutcore/apps/statechart_routing/statechart.js +76 -0
  23. data/lib/frameworks/sproutcore/apps/statechart_routing/theme.js +27 -0
  24. data/lib/frameworks/sproutcore/apps/tests/controllers/targets.js +1 -1
  25. data/lib/frameworks/sproutcore/apps/tests/states/no_targets.js +1 -1
  26. data/lib/frameworks/sproutcore/apps/tests/states/ready_detail.js +1 -1
  27. data/lib/frameworks/sproutcore/apps/tests/states/ready_empty.js +1 -1
  28. data/lib/frameworks/sproutcore/apps/tests/states/ready_list.js +1 -1
  29. data/lib/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +1 -1
  30. data/lib/frameworks/sproutcore/apps/welcome/controllers/targets.js +1 -1
  31. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +14 -1
  32. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +15 -15
  33. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/animation/core.js +8 -5
  35. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +302 -70
  36. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +19 -14
  37. data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +471 -149
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +3 -3
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +42 -0
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/run_loop.js +3 -2
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/string.js +7 -0
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +1 -1
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +2 -2
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +3 -3
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/selection_support.js +1 -1
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/body_overflow.js +63 -0
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +1 -1
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +37 -2
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +28 -6
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +10 -3
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/sparse_array_delegate.js +2 -2
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +66 -2
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +1 -1
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/cursor.js +1 -1
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +58 -57
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +1 -1
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js.orig +445 -0
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +51 -31
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +5 -1
  60. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +53 -69
  61. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
  62. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +98 -72
  63. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +37 -3
  64. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +7 -4
  65. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +21 -0
  66. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +7 -7
  67. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +23 -1
  68. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/browser.js +66 -0
  69. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/event.js +22 -0
  70. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/locale.js +11 -11
  71. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/end.js +4 -4
  72. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/escape_html.js +41 -0
  73. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_className.js +1 -1
  74. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +8 -8
  75. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/update.js +17 -16
  76. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/selection_set/remove.js +1 -1
  77. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +1 -1
  78. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +15 -0
  79. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +5 -5
  80. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +50 -30
  81. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/acceleration.js +46 -0
  82. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +1 -43
  83. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +8 -34
  84. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +3 -2
  85. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +10 -1
  86. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +6 -5
  87. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +22 -2
  88. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +2 -2
  89. data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +1 -1
  90. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +0 -2
  91. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +35 -0
  92. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +46 -19
  93. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +23 -9
  94. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -3
  95. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +1 -1
  96. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +2 -2
  97. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +294 -302
  98. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js.orig +1531 -0
  99. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +4 -2
  100. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +14 -11
  101. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/many_array.js +63 -0
  102. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +1 -1
  103. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +4 -4
  104. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +50 -10
  105. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +4 -4
  106. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +3 -3
  107. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +1 -1
  108. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +1 -1
  109. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
  110. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +114 -67
  111. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +1 -1
  112. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +1 -1
  113. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +54 -1
  114. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +29 -9
  115. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +1 -1
  116. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +1 -1
  117. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +1 -1
  118. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +1 -1
  119. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +1 -1
  120. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +37 -45
  121. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +127 -127
  122. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +16 -0
  123. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +42 -4
  124. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +1 -1
  125. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +13 -7
  126. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +8 -0
  127. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/resources/strings.js +2 -1
  128. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +1 -0
  129. data/lib/frameworks/sproutcore/frameworks/debug/core.js +3 -3
  130. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +1 -1
  131. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
  132. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +1 -1
  133. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +1 -4
  134. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +19 -6
  135. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +30 -1
  136. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +1 -1
  137. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +24 -1
  138. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +121 -28
  139. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +15 -15
  140. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +1 -1
  141. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +2 -2
  142. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +2 -2
  143. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +39 -15
  144. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +3 -3
  145. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +2 -2
  146. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +2 -2
  147. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +14 -6
  148. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/popup_button.js +3 -3
  149. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +11 -11
  150. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -3
  151. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -51
  152. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +11 -16
  153. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
  154. data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +0 -2
  155. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +3 -3
  156. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +3 -3
  157. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +9 -9
  158. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/content.js +11 -11
  159. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +2 -1
  160. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +1 -1
  161. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +107 -81
  162. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +3 -3
  163. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +68 -60
  164. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +57 -12
  165. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/integration.js +21 -19
  166. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +5 -0
  167. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +2 -2
  168. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +32 -3
  169. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +12 -0
  170. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +12 -0
  171. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +0 -8
  172. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +77 -132
  173. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +5 -6
  174. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +16 -15
  175. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +52 -52
  176. data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +1 -1
  177. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -1
  178. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +147 -147
  179. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +11 -2
  180. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +2 -2
  181. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +5 -5
  182. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +22 -12
  183. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +13 -7
  184. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +2 -2
  185. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +462 -441
  186. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +48 -62
  187. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +22 -2
  188. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +150 -32
  189. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +104 -45
  190. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +42 -20
  191. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +24 -24
  192. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +148 -154
  193. data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +2 -2
  194. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -2
  195. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +8 -7
  196. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +2 -2
  197. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
  198. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/files.js +1 -1
  199. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/library.js +1 -1
  200. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/targets.js +1 -1
  201. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/view_configs.js +1 -1
  202. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/mixins/drop_down.js +1 -1
  203. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/states/ready.js +1 -1
  204. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/plist_item.js +1 -1
  205. data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js +1 -1
  206. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/controllers/page_design.js +2 -2
  207. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/css/css_style_sheet.js +2 -2
  208. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/object_designer.js +1 -1
  209. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +2 -2
  210. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/mixins/snap_lines.js +3 -3
  211. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/designer_drop_target.js +1 -1
  212. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/drawing.js +21 -21
  213. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/page_item_view.js +1 -1
  214. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +59 -53
  215. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +2 -2
  216. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphism/simple.js +1 -1
  217. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +6 -6
  218. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +2 -2
  219. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +2 -2
  220. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +14 -10
  221. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +17 -6
  222. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +38 -14
  223. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +5 -13
  224. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +1 -1
  225. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +5 -3
  226. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/children.js +19 -0
  227. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/methods.js +20 -2
  228. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/split_thumb.js +1 -1
  229. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +35 -12
  230. data/lib/frameworks/sproutcore/frameworks/formatters/README +6 -0
  231. data/lib/frameworks/sproutcore/frameworks/formatters/english.lproj/strings.js +174 -0
  232. data/lib/frameworks/sproutcore/frameworks/formatters/formatters/date_formatter.js +351 -0
  233. data/lib/frameworks/sproutcore/frameworks/formatters/tests/date_formatter.js +517 -0
  234. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +1 -1
  235. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +345 -138
  236. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +5 -3
  237. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +176 -42
  238. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +1 -1
  239. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +137 -105
  240. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gestureable.js +2 -2
  241. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +2 -2
  242. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +16 -1
  243. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +1 -1
  244. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +47 -47
  245. data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +3 -3
  246. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +1 -1
  247. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +28 -6
  248. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +1 -1
  249. data/lib/frameworks/sproutcore/frameworks/foundation/resources/benchmark.css +0 -5
  250. data/lib/frameworks/sproutcore/frameworks/foundation/resources/bootstrap.rhtml +34 -19
  251. data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +0 -2
  252. data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +1 -5
  253. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +8 -9
  254. data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +2 -2
  255. data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +179 -47
  256. data/lib/frameworks/sproutcore/frameworks/foundation/system/task_queue.js +34 -1
  257. data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +1 -1
  258. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +26 -12
  259. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +7 -7
  260. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +12 -4
  261. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_metric_optimization.js +202 -0
  262. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js +77 -8
  263. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +1 -0
  264. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/beginEditing.js +2 -2
  265. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/commitEditing.js +4 -3
  266. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/discardEditing.js +4 -2
  267. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/beginEditing.js +2 -2
  268. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/commitEditing.js +4 -2
  269. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/discardEditing.js +4 -2
  270. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +2 -2
  271. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +0 -8
  272. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +163 -149
  273. data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +1 -1
  274. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +1 -1
  275. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
  276. data/lib/frameworks/sproutcore/frameworks/foundation/validators/password.js +1 -1
  277. data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +3 -3
  278. data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +16 -43
  279. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +4 -3
  280. data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +67 -54
  281. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +49 -38
  282. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +285 -242
  283. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +13 -13
  284. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +19 -22
  285. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-sc.js +9 -3
  286. data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +231 -186
  287. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +145 -143
  288. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +156 -154
  289. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +5 -5
  290. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +3 -3
  291. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js.orig +540 -0
  292. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +2 -2
  293. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -8
  294. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +5 -5
  295. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +12 -0
  296. data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +2 -2
  297. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +1 -1
  298. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +1 -1
  299. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +7 -7
  300. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +98 -32
  301. data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +7 -2
  302. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +14 -3
  303. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +98 -13
  304. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +8 -14
  305. data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +1 -1
  306. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +2 -2
  307. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +23 -6
  308. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +69 -18
  309. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +57 -31
  310. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +189 -14
  311. data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +82 -22
  312. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +20 -0
  313. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +125 -4
  314. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +1 -1
  315. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +2 -2
  316. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +37 -0
  317. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +2 -2
  318. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +16 -0
  319. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +75 -4
  320. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +41 -0
  321. data/lib/frameworks/sproutcore/frameworks/statechart/mixins/statechart_delegate.js +113 -0
  322. data/lib/frameworks/sproutcore/frameworks/statechart/private/state_path_matcher.js +312 -0
  323. data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +18 -22
  324. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +508 -131
  325. data/lib/frameworks/sproutcore/frameworks/statechart/system/state_route_handler_context.js +78 -0
  326. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +265 -44
  327. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +16 -0
  328. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/responder/responder_chain.js +11 -3
  329. data/lib/frameworks/sproutcore/frameworks/statechart/tests/private/state_path_matcher.js +116 -0
  330. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/add_substate.js +108 -0
  331. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/find_first_relative_current_state/with_concurrent.js +179 -0
  332. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/find_first_relative_current_state/without_concurrent.js +74 -0
  333. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/get_state.js +141 -0
  334. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/get_substate.js +340 -0
  335. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/route_triggered.js +161 -0
  336. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/try_to_handle_event.js +288 -0
  337. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/history_state/standard/without_concurrent_states/context.js +5 -33
  338. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/with_concurrent_states/basic.js +213 -0
  339. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/without_concurrent_states/basic.js +212 -0
  340. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/without_concurrent_states/core.js +8 -0
  341. data/lib/frameworks/sproutcore/frameworks/statechart/tests/{state/namespacing.js → statechart/methods/get_state.js} +3 -41
  342. data/lib/frameworks/sproutcore/frameworks/statechart/tests/statechart/{invoke_state_method.js → methods/invoke_state_method.js} +1 -1
  343. data/lib/frameworks/sproutcore/frameworks/statechart/tests/{event_handling/advanced → statechart}/respond_to_event.js +1 -1
  344. data/lib/frameworks/sproutcore/frameworks/statechart/tests/system/state_route_handler_context/methods/retry.js +64 -0
  345. data/lib/frameworks/sproutcore/frameworks/table/core.js +2 -0
  346. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/controls/button.js +0 -1
  347. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars.js +29 -5
  348. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/bind.js +4 -3
  349. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/collection.js +0 -0
  350. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/localization.js +0 -0
  351. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/view.js +0 -0
  352. data/lib/frameworks/sproutcore/frameworks/{handlebars → template_view}/handlebars.js +493 -357
  353. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/mixins/template_helpers/checkbox_support.js +0 -0
  354. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/mixins/template_helpers/text_field_support.js +13 -2
  355. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/panes/template.js +0 -0
  356. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/controls/button.js +0 -0
  357. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/mixins/template_helpers/checkbox_support.js +0 -0
  358. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/mixins/template_helpers/text_field_support.js +0 -0
  359. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/panes/template.js +0 -0
  360. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/collection.js +39 -14
  361. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/core.js +0 -0
  362. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/handlebars.js +57 -6
  363. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/bindable_span.js +21 -6
  364. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/template.js +9 -3
  365. data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/template_collection.js +55 -26
  366. data/lib/frameworks/sproutcore/frameworks/testing/system/equiv.js +1 -1
  367. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +122 -122
  368. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +2 -2
  369. data/lib/frameworks/sproutcore/frameworks/testing/system/suite.js +4 -4
  370. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +1 -1
  371. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +0 -1
  372. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +4 -4
  373. data/lib/frameworks/sproutcore/lib/index.rhtml +55 -32
  374. data/lib/frameworks/sproutcore/license.js +2 -4
  375. data/lib/frameworks/sproutcore/themes/ace/resources/body.css +5 -1
  376. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +2 -2
  377. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/24px/button.css +21 -13
  378. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/30px/button.css +17 -10
  379. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +4 -3
  380. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/24px/button.css +20 -12
  381. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/30px/button.css +16 -8
  382. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/jumbo/button.css +17 -0
  383. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/small/button.css +17 -0
  384. data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +2 -2
  385. data/lib/frameworks/sproutcore/themes/ace/resources/master-detail/master-detail.css +2 -2
  386. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +5 -3
  387. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +1 -1
  388. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/toolbar.css +1 -1
  389. data/lib/gen/app/USAGE +17 -4
  390. data/lib/gen/language/Buildfile +4 -4
  391. data/lib/gen/language/USAGE +4 -4
  392. data/lib/gen/page/templates/pages/@target_name@/Buildfile +7 -7
  393. data/lib/gen/{html_app → statechart_app}/Buildfile +0 -0
  394. data/lib/gen/{html_app → statechart_app}/README +0 -0
  395. data/lib/gen/statechart_app/USAGE +21 -0
  396. data/lib/gen/statechart_app/templates/apps/@target_name@/Buildfile +9 -0
  397. data/lib/gen/statechart_app/templates/apps/@target_name@/core.js +24 -0
  398. data/lib/gen/statechart_app/templates/apps/@target_name@/main.js +26 -0
  399. data/lib/gen/statechart_app/templates/apps/@target_name@/resources/_theme.css +18 -0
  400. data/lib/gen/statechart_app/templates/apps/@target_name@/resources/loading.rhtml +9 -0
  401. data/lib/gen/statechart_app/templates/apps/@target_name@/resources/main_page.js +21 -0
  402. data/lib/gen/statechart_app/templates/apps/@target_name@/statechart.js +8 -0
  403. data/lib/gen/statechart_app/templates/apps/@target_name@/states/ready_state.js +12 -0
  404. data/lib/gen/statechart_app/templates/apps/@target_name@/theme.js +24 -0
  405. data/lib/sproutcore/builders.rb +1 -0
  406. data/lib/sproutcore/builders/base.rb +19 -1
  407. data/lib/sproutcore/builders/chance_file.rb +6 -1
  408. data/lib/sproutcore/builders/handlebars.rb +1 -9
  409. data/lib/sproutcore/builders/javascript.rb +1 -10
  410. data/lib/sproutcore/builders/json.rb +25 -0
  411. data/lib/sproutcore/builders/less.rb +1 -1
  412. data/lib/sproutcore/builders/sass.rb +1 -1
  413. data/lib/sproutcore/builders/stylesheet.rb +1 -9
  414. data/lib/sproutcore/helpers/html5_manifest.rb +1 -1
  415. data/lib/sproutcore/helpers/static_helper.rb +42 -0
  416. data/lib/sproutcore/rack/proxy.rb +21 -3
  417. data/lib/sproutcore/rack/service.rb +3 -2
  418. data/lib/sproutcore/tools.rb +18 -25
  419. data/lib/sproutcore/tools/gen.rb +10 -3
  420. data/lib/sproutcore/tools/init.rb +11 -10
  421. data/spec/buildtasks/manifest/prepare_build_tasks/json_spec.rb +62 -0
  422. data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -1
  423. data/spec/fixtures/builder_tests/apps/json_test/sc_static.json +2 -0
  424. data/spec/lib/builders/json_spec.rb +53 -0
  425. data/sproutcore.gemspec +2 -2
  426. data/vendor/chance/lib/chance/parser.rb +1 -1
  427. metadata +222 -177
  428. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
  429. data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +0 -259
  430. data/lib/frameworks/sproutcore/frameworks/documentation/core.js +0 -0
  431. data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +0 -69
  432. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +0 -44
  433. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +0 -64
  434. data/lib/frameworks/sproutcore/frameworks/mini/license.js +0 -30
  435. data/lib/gen/html_app/USAGE +0 -15
  436. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +0 -11
  437. data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
  438. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -6
  439. data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +0 -1
  440. data/lib/gen/html_project/Buildfile +0 -45
  441. data/lib/gen/html_project/INIT +0 -3
  442. data/lib/gen/html_project/README +0 -1
  443. data/lib/gen/html_project/USAGE +0 -2
  444. data/lib/gen/html_project/templates/@filename@/Buildfile +0 -5
  445. data/lib/gen/html_project/templates/@filename@/README +0 -4
@@ -23,7 +23,7 @@ module("SC.NestedStore#commitChangesFromNestedStore", {
23
23
  store = parent.chain();
24
24
  child = store.chain(); // test multiple levels deep
25
25
 
26
- // wirte basic status
26
+ // write basic status
27
27
  child.writeDataHash(storeKey, json, SC.Record.READY_DIRTY);
28
28
  child.dataHashDidChange(storeKey);
29
29
  child.changelog = SC.Set.create();
@@ -150,7 +150,7 @@ test("data state=EDITABLE", function() {
150
150
  });
151
151
 
152
152
  test("should return null when accessing an unknown storeKey", function() {
153
- equals(store.readDataHash(20000000), null, 'shuld return null for non-existant store key');
153
+ equals(store.readDataHash(20000000), null, 'should return null for non-existent store key');
154
154
  equals(store.storeKeyEditState(20000000), SC.Store.LOCKED, 'should put into locked edit state');
155
155
  });
156
156
 
@@ -36,7 +36,21 @@ module("SC.Query comparison of records", {
36
36
  rec3 = MyApp.store.find(MyApp.Foo,3);
37
37
  rec4 = MyApp.store.find(MyApp.Foo,4);
38
38
  rec5 = MyApp.store.find(MyApp.Foo,5);
39
-
39
+ rec6 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Clark", lastName: "Douglas", active: true });
40
+ rec7 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Amy", lastName: "Simmons", active: true });
41
+ rec8 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Fred", lastName: "Chambers", active: false });
42
+ rec9 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Mari", lastName: "Chambers", active: false });
43
+ rec10 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Glenn", lastName: "Armour", active: true });
44
+ rec11 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Jake", lastName: "Timmons", active: true });
45
+ rec12 = MyApp.store.createRecord(MyApp.Foo, { firstName: "John", lastName: "Fitzgerald", active: true });
46
+ rec13 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Carly", lastName: "Anderson", active: true });
47
+ rec14 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Clark", lastName: "Thompson", active: true });
48
+ rec15 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Indi", lastName: "Karish", active: true });
49
+ rec16 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Yi Jia", lastName: "Li", active: true });
50
+ rec17 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Marcel", lastName: "Frontenac", active: true });
51
+ rec18 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Amie", lastName: "Frontenac", active: true });
52
+ rec19 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Amelie", lastName: "Auguste", active: true });
53
+ rec20 = MyApp.store.createRecord(MyApp.Foo, { firstName: "Percy", lastName: "Douglas", active: true });
40
54
 
41
55
  q = SC.Query.create();
42
56
  }
@@ -88,6 +102,44 @@ test("no order should result in comparison by guid", function() {
88
102
  q.orderBy = null;
89
103
  q.parse();
90
104
  equals(q.compare(rec1,rec2), -1, 'guid 1 should be before guid 2');
105
+ /**
106
+ This test was added to prove new code that switched from ordering by guid
107
+ if there is no orderBy property on the query to ordering by storeKey if
108
+ there is no orderBy property. The reason is that new records that haven't
109
+ been committed may not have a guid and therefore comparing null to null
110
+ would result in the order changing slightly in Chrome when the array length
111
+ grew over 10 items long. For some reason if every comparison in the sort
112
+ returns 0, the first item and second item swap places and then the new first
113
+ and the middle item swap places (or vice versa). If you get objectAt(0) on
114
+ this type of RecordArray, it cycles between three different values.
115
+
116
+ See it in action in Chrome 17.0 on Mac:
117
+
118
+ > [0,1,2,3,4,5,6,7,8,9].sort(function(a,b) { return 0; })
119
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
120
+ > [0,1,2,3,4,5,6,7,8,9,10].sort(function(a,b) { return 0; })
121
+ [5, 0, 2, 3, 4, 1, 6, 7, 8, 9, 10]
122
+ // WTF? So the next time the RecordArray flushes its array will be
123
+ // [5, 0, 2, 3, 4, 1, 6, 7, 8, 9, 10] and it keeps changing each flush.
124
+ > [5, 0, 2, 3, 4, 1, 6, 7, 8, 9, 10].sort(function(a,b) { return 0; })
125
+ [1, 5, 2, 3, 4, 0, 6, 7, 8, 9, 10]
126
+ */
127
+ test("storeKeys should maintain order between repeat calls to orderStoreKeys even if the array is longer than 10 items and the matching records have no ids", function() {
128
+ var records,
129
+ storeKeysSorted1,
130
+ storeKeysSorted2,
131
+ storeKeys;
132
+
133
+ q.orderBy = null;
134
+ q.parse();
135
+
136
+ records = MyApp.store.find(MyApp.Foo);
137
+ records.flush();
138
+
139
+ storeKeys = records.get('storeKeys');
140
+ storeKeysSorted1 = SC.Query.orderStoreKeys(records.get('storeKeys'), q, MyApp.store).copy();
141
+ storeKeysSorted2 = SC.Query.orderStoreKeys(records.get('storeKeys'), q, MyApp.store).copy();
142
+ ok(storeKeysSorted1.isEqual(storeKeysSorted2), 'Each time you call orderStoreKeys, it should return the same order if the storeKeys haven\'t changed');
91
143
  });
92
144
 
93
145
  test("comparing non existent properties", function() {
@@ -142,3 +194,4 @@ test("specifying a custom orderBy comparison function", function() {
142
194
  equals(q.compare(rec1,rec2), 1, 'guid 2 should be before guid 1');
143
195
  equals(usedCustomFunction, YES, 'we should have used our custom comparison function');
144
196
  });
197
+
@@ -110,42 +110,62 @@ test("should evaluate all comparators", function() {
110
110
  q.conditions = "'Tea pot' ENDS_WITH 'a cup'";
111
111
  q.parse();
112
112
  ok(q._tokenTree.evaluate() === false, "'Tea pot' ENDS_WITH 'a cup' should be false");
113
+
114
+ q.conditions = "'baguette fille bouteille fée' ENDS_WITH 'ille'";
115
+ q.parse();
116
+ ok(q._tokenTree.evaluate() === false, "'baguette fille bouteille fée' ENDS_WITH 'ille' should be false");
117
+
118
+ q.conditions = "'baguette fille bouteille' ENDS_WITH 'ille'";
119
+ q.parse();
120
+ ok(q._tokenTree.evaluate() === true, "'baguette fille bouteille' ENDS_WITH 'ille' should be true");
121
+
122
+ q.conditions = "'fée' ENDS_WITH 'ille'";
123
+ q.parse();
124
+ ok(q._tokenTree.evaluate() === false, "'fée' ENDS_WITH 'ille' should be false");
125
+
126
+ q.conditions = "'fille baguette bouteílle' ENDS_WITH 'ille'";
127
+ q.parse();
128
+ ok(q._tokenTree.evaluate() === false, "'fille baguette bouteílle' ENDS_WITH 'ille' should be false");
129
+
130
+ q.conditions = "'fille baguette bouteílle' ENDS_WITH 'ílle'";
131
+ q.parse();
132
+ ok(q._tokenTree.evaluate() === true, "'fille baguette bouteílle' ENDS_WITH 'ílle' should be true");
113
133
 
114
134
  q.conditions = "'Tea pot' CONTAINS 'Tea pot'";
115
135
  q.parse();
116
- ok(q._tokenTree.evaluate() == true, "'Tea pot' CONTAINS 'Tea pot' should be true");
136
+ ok(q._tokenTree.evaluate() === true, "'Tea pot' CONTAINS 'Tea pot' should be true");
117
137
 
118
138
  q.conditions = "'Tea pot' CONTAINS 'Tea'";
119
139
  q.parse();
120
- ok(q._tokenTree.evaluate() == true, "'Tea pot' CONTAINS 'Tea' should be true");
140
+ ok(q._tokenTree.evaluate() === true, "'Tea pot' CONTAINS 'Tea' should be true");
121
141
 
122
142
  q.conditions = "'Tea pot' CONTAINS 'pot'";
123
143
  q.parse();
124
- ok(q._tokenTree.evaluate() == true, "'Tea pot' CONTAINS 'pot' should be true");
144
+ ok(q._tokenTree.evaluate() === true, "'Tea pot' CONTAINS 'pot' should be true");
125
145
 
126
146
  q.conditions = "'Tea pot' CONTAINS 'a po'";
127
147
  q.parse();
128
- ok(q._tokenTree.evaluate() == true, "'Tea pot' CONTAINS 'a po' should be true");
148
+ ok(q._tokenTree.evaluate() === true, "'Tea pot' CONTAINS 'a po' should be true");
129
149
 
130
150
  q.conditions = "'Tea pot' CONTAINS 'a cup'";
131
151
  q.parse();
132
- ok(q._tokenTree.evaluate() == false, "'Tea pot' CONTAINS 'a cup' should be false");
152
+ ok(q._tokenTree.evaluate() === false, "'Tea pot' CONTAINS 'a cup' should be false");
133
153
 
134
154
  q.conditions = "{myTeapot} CONTAINS 'Tea'";
135
155
  q.parse();
136
- ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == true, "['Tea', 'pot'] CONTAINS 'Tea' should be true");
156
+ ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) === true, "['Tea', 'pot'] CONTAINS 'Tea' should be true");
137
157
 
138
158
  q.conditions = "{myTeapot} CONTAINS 'pot'";
139
159
  q.parse();
140
- ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == true, "['Tea', 'pot'] CONTAINS 'pot' should be true");
160
+ ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) === true, "['Tea', 'pot'] CONTAINS 'pot' should be true");
141
161
 
142
162
  q.conditions = "{myTeapot} CONTAINS 'coffee'";
143
163
  q.parse();
144
- ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == false, "['Tea', 'pot'] CONTAINS 'coffee' should be false");
164
+ ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) === false, "['Tea', 'pot'] CONTAINS 'coffee' should be false");
145
165
 
146
166
  q.conditions = "'Tea pot' MATCHES {myCup}";
147
167
  q.parse();
148
- ok(q._tokenTree.evaluate(null,{myCup: /a\sp/}) === true, "'Tea pot' MATCHES /a\sp/ should be true");
168
+ ok(q._tokenTree.evaluate(null,{myCup: /a\sp/}) === true, "'Tea pot' MATCHES /a\\sp/ should be true");
149
169
 
150
170
  q.conditions = "'Tea pot' MATCHES {myCup}";
151
171
  q.parse();
@@ -217,7 +217,7 @@ test("token tree should build", function() {
217
217
  q.parse();
218
218
  ok(q._tokenList.length == 13, 'list should have 13 tokens');
219
219
  ok(!q._tokenTree.error, 'there should be no errors');
220
- ok(q._tokenTree.tokenValue == 'AND', 'tree root shoud be AND');
220
+ ok(q._tokenTree.tokenValue == 'AND', 'tree root should be AND');
221
221
 
222
222
  });
223
223
 
@@ -64,7 +64,7 @@ test("should materialize record for object", function() {
64
64
  });
65
65
 
66
66
  test("reading past end of array length should return undefined", function() {
67
- equals(recs.objectAt(2000), undefined, 'recs.objectAt(2000) should be undeinfed');
67
+ equals(recs.objectAt(2000), undefined, 'recs.objectAt(2000) should be undefined');
68
68
  });
69
69
 
70
70
  test("modifying the underlying storeKey should change the returned materialized record", function() {
@@ -94,7 +94,7 @@ test("calling storeDidChangeStoreKeys() with a matching recordType", function()
94
94
 
95
95
  recs.storeDidChangeStoreKeys([storeKey], SC.Set.create().add(SC.Record));
96
96
 
97
- orig.unshift(storeKey); // update - must be first b/c id.bar < id.foo
97
+ orig.push(storeKey); // update - must be last b/c id.bar.storeKey < id.foo.storeKey
98
98
  equals(recs.get('needsFlush'), NO, 'should not need flush anymore');
99
99
  same(recs.get('storeKeys'), orig, 'storeKeys should now be updated - rec1[%@]{%@} = %@, rec2[%@]{%@} = %@'.fmt(
100
100
  rec.get('id'), rec.get('storeKey'), rec,
@@ -49,6 +49,6 @@ test("Check for error state handling and make sure that the method executes.", f
49
49
  }catch (error){
50
50
  throwError=false;
51
51
  }
52
- ok(throwError, " cancelRecord was succesfully executed.");
52
+ ok(throwError, " cancelRecord was successfully executed.");
53
53
 
54
54
  });
@@ -22,7 +22,7 @@ module("SC.Store#commitChangesFromNestedStore", {
22
22
 
23
23
  child = store.chain(); // test multiple levels deep
24
24
 
25
- // wirte basic status
25
+ // write basic status
26
26
  child.writeDataHash(storeKey, json, SC.Record.READY_DIRTY);
27
27
  child.dataHashDidChange(storeKey);
28
28
  child.changelog = SC.Set.create();
@@ -13,9 +13,9 @@ module("SC.Store#commitRecord", {
13
13
  setup: function() {
14
14
 
15
15
  ds = SC.DataSource.create({
16
-
16
+
17
17
  callCount: 0,
18
-
18
+
19
19
  commitRecords: function(store, toCreate, toUpdate, toDestroy, params) {
20
20
  this.toCreate = toCreate;
21
21
  this.toUpdate = toUpdate;
@@ -23,17 +23,17 @@ module("SC.Store#commitRecord", {
23
23
  this.params = params;
24
24
  this.callCount++;
25
25
  },
26
-
26
+
27
27
  reset: function() {
28
28
  this.toCreate = this.toUpdate = this.toDestroy = this.params = null;
29
29
  this.callCount = 0 ;
30
30
  },
31
-
31
+
32
32
  expect: function(callCount, toCreate, toUpdate, toDestroy, params) {
33
33
  if (callCount !== undefined) {
34
34
  equals(this.callCount, callCount, 'expect datasource.commitRecords to be called X times');
35
35
  }
36
-
36
+
37
37
  if (toCreate !== undefined) {
38
38
  same(this.toCreate, toCreate, 'expect toCreate to have items');
39
39
  }
@@ -41,7 +41,7 @@ module("SC.Store#commitRecord", {
41
41
  if (toUpdate !== undefined) {
42
42
  same(this.toUpdate, toUpdate, 'expect toUpdate to have items');
43
43
  }
44
-
44
+
45
45
  if (toDestroy !== undefined) {
46
46
  same(this.toDestroy, toDestroy, 'expect toDestroy to have items');
47
47
  }
@@ -50,11 +50,11 @@ module("SC.Store#commitRecord", {
50
50
  same(this.params, params, 'expect params to have items');
51
51
  }
52
52
  }
53
-
53
+
54
54
  });
55
-
55
+
56
56
  store = SC.Store.create().from(ds);
57
-
57
+
58
58
  json1 = {
59
59
  guid: "commitGUID1",
60
60
  string: "string",
@@ -97,7 +97,7 @@ module("SC.Store#commitRecord", {
97
97
  number: 23,
98
98
  bool: YES
99
99
  };
100
-
100
+
101
101
  SC.RunLoop.begin();
102
102
  storeKey1 = SC.Store.generateStoreKey();
103
103
  store.writeDataHash(storeKey1, json1, SC.Record.READY_CLEAN);
@@ -108,11 +108,11 @@ module("SC.Store#commitRecord", {
108
108
  storeKey4 = SC.Store.generateStoreKey();
109
109
  store.writeDataHash(storeKey4, json4, SC.Record.DESTROYED_DIRTY);
110
110
  storeKey5 = SC.Store.generateStoreKey();
111
- store.writeDataHash(storeKey5, json5, SC.Record.READY_EMPTY);
111
+ store.writeDataHash(storeKey5, json5, SC.Record.EMPTY);
112
112
  storeKey6 = SC.Store.generateStoreKey();
113
- store.writeDataHash(storeKey6, json6, SC.Record.READY_ERROR);
113
+ store.writeDataHash(storeKey6, json6, SC.Record.ERROR);
114
114
  storeKey7 = SC.Store.generateStoreKey();
115
- store.writeDataHash(storeKey7, json7, SC.Record.READY_DESTROYED_CLEAN);
115
+ store.writeDataHash(storeKey7, json7, SC.Record.DESTROYED_CLEAN);
116
116
  SC.RunLoop.end();
117
117
  }
118
118
  });
@@ -123,7 +123,7 @@ test("Confirm that all the states are switched as expected after running commitR
123
123
  store.commitRecord(undefined, undefined, storeKey1);
124
124
  status = store.readStatus( storeKey1);
125
125
  equals(status, SC.Record.READY_CLEAN, "the status shouldn't have changed. It should be READY_CLEAN ");
126
-
126
+
127
127
  store.commitRecord(undefined, undefined, storeKey2);
128
128
  status = store.readStatus( storeKey2);
129
129
  equals(status, SC.Record.BUSY_CREATING, "the status should be SC.Record.BUSY_CREATING");
@@ -131,45 +131,37 @@ test("Confirm that all the states are switched as expected after running commitR
131
131
  store.commitRecord(undefined, undefined, storeKey3);
132
132
  status = store.readStatus( storeKey3);
133
133
  equals(status, SC.Record.BUSY_COMMITTING, "the status should be SC.Record.BUSY_COMMITTING");
134
-
134
+
135
135
  store.dataSourceDidComplete(storeKey3);
136
136
  status = store.readStatus( storeKey3);
137
137
  equals(status, SC.Record.READY_CLEAN, "the status should be SC.Record.READY_CLEAN");
138
-
138
+
139
139
  store.commitRecord(undefined, undefined, storeKey4);
140
140
  status = store.readStatus( storeKey4);
141
141
  equals(status, SC.Record.BUSY_DESTROYING, "the status should be SC.Record.BUSY_DESTROYING");
142
-
143
- try {
144
- store.commitRecord(undefined, undefined, storeKey5);
145
- throwError=false;
146
- msg='';
147
- }catch(error1){
148
- throwError=true;
149
- msg=error1.message;
150
- }
151
- equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");
152
-
142
+
143
+ store.dataSourceDidDestroy(storeKey4);
144
+ status = store.readStatus(storeKey4);
145
+ equals(status, SC.Record.DESTROYED_CLEAN, "the status should be SC.Record.DESTROYED_CLEAN");
146
+
147
+ store.commitRecord(undefined, undefined, storeKey5);
148
+ status = store.readStatus( storeKey5);
149
+ equals(status, SC.Record.EMPTY, "the status should be SC.Record.EMPTY");
150
+
153
151
  try{
154
152
  store.commitRecord(undefined, undefined, storeKey6);
155
153
  throwError=false;
156
154
  msg='';
157
- }catch(error2){
155
+ }catch(error){
158
156
  throwError=true;
159
- msg=error2.message;
157
+ msg=error.message;
160
158
  }
161
159
  equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");
162
-
163
- try{
164
- store.commitRecord(undefined, undefined, storeKey7);
165
- throwError=false;
166
- msg='';
167
- }catch(error3){
168
- throwError=true;
169
- msg=error3.message;
170
- }
171
- equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");
172
-
160
+
161
+ store.commitRecord(undefined, undefined, storeKey7);
162
+ status = store.readStatus( storeKey7);
163
+ equals(status, SC.Record.DESTROYED_CLEAN, "the status should be SC.Record.DESTROYED_CLEAN");
164
+
173
165
  });
174
166
 
175
167
  test("calling commitRecords() without explicit storeKeys", function() {
@@ -179,16 +171,16 @@ test("calling commitRecords() without explicit storeKeys", function() {
179
171
 
180
172
  st = store.readStatus( storeKey1);
181
173
  equals(st, SC.Record.READY_CLEAN, "storeKey1 - the status shouldn't have changed. It should be READY_CLEAN ");
182
-
174
+
183
175
  st = store.readStatus( storeKey2);
184
176
  equals(st, SC.Record.BUSY_CREATING, "storeKey2 - the status should be SC.Record.BUSY_CREATING");
185
177
 
186
178
  st = store.readStatus( storeKey3);
187
179
  equals(st, SC.Record.BUSY_COMMITTING, "storeKey3 - the status should be SC.Record.BUSY_COMMITTING");
188
-
180
+
189
181
  st = store.readStatus( storeKey4);
190
182
  equals(st, SC.Record.BUSY_DESTROYING, "storeKey4 - the status should be SC.Record.BUSY_DESTROYING");
191
-
183
+
192
184
  ds.expect(1, [storeKey2], [storeKey3], [storeKey4]);
193
185
  });
194
186
 
@@ -202,7 +194,7 @@ test("calling commitRecords() with params", function() {
202
194
  store.commitRecords(null,null,null,p);
203
195
  ds.expect(1, [], [], [], p);
204
196
  ds.reset();
205
-
197
+
206
198
  // call commit records with no storeKeys and no params should not invoke ds
207
199
  store.commitRecords(null,null,null,null);
208
200
  ds.expect(0);
@@ -211,7 +203,7 @@ test("calling commitRecords() with params", function() {
211
203
  test("calling commitRecords() with callbacks", function() {
212
204
  var wasCalled = NO;
213
205
  var cb = function(){wasCalled = YES;};
214
-
206
+
215
207
  store.commitRecord(null, null, storeKey2, {}, cb);
216
208
  ok(store._callback_queue[storeKey2], "should have a callback in the queue");
217
209
  ok(!wasCalled, "wasn't called yet");
@@ -11,11 +11,11 @@ module("SC.Query querying find() on a store", {
11
11
  SC.RunLoop.begin();
12
12
  // setup dummy app and store
13
13
  MyApp = SC.Object.create({});
14
-
14
+
15
15
  // setup a dummy model
16
16
  MyApp.Foo = SC.Record.extend();
17
17
  MyApp.Bar = SC.Record.extend();
18
-
18
+
19
19
  // setup data source that just returns cached storeKeys
20
20
  MyApp.DataSource = SC.DataSource.create({
21
21
 
@@ -23,42 +23,42 @@ module("SC.Query querying find() on a store", {
23
23
  this.query = query;
24
24
  this.store = store;
25
25
  this.fetchCount++ ;
26
-
26
+
27
27
  // used by tests to verify remote queries
28
28
  if (query.get('location') === SC.Query.REMOTE) {
29
29
  if (query.get('recordType') === MyApp.Foo) {
30
- store.loadQueryResults(query, this.get('storeKeys'));
30
+ store.loadQueryResults(query, this.get('storeKeys'));
31
31
  }
32
32
  }
33
-
33
+
34
34
  return YES ;
35
35
  },
36
-
36
+
37
37
  reset: function() {
38
38
  this.query = this.store = null ;
39
39
  this.fetchCount = this.prepareCount = 0 ;
40
40
  },
41
-
41
+
42
42
  fetchEquals: function(store, query, count, desc) {
43
43
  if (desc===undefined && typeof count === 'string') {
44
44
  desc = count; count = undefined;
45
45
  }
46
- if (count===undefined) count = 1;
47
-
46
+ if (count===undefined) count = 1;
47
+
48
48
  equals(this.store, store, desc + ': should get store');
49
49
  equals(this.query, query, desc + ': should get query');
50
50
  equals(this.fetchCount, count, desc + ': should get count');
51
51
  },
52
-
52
+
53
53
  destroyRecord: function(store, storeKey){
54
54
  store.dataSourceDidDestroy(storeKey);
55
55
  return YES;
56
56
  }
57
-
57
+
58
58
  });
59
-
59
+
60
60
  MyApp.store = SC.Store.create().from(MyApp.DataSource);
61
-
61
+
62
62
  var records = [
63
63
  { guid: 1, firstName: "John", lastName: "Doe", married: true },
64
64
  { guid: 2, firstName: "Jane", lastName: "Doe", married: false },
@@ -66,40 +66,40 @@ module("SC.Query querying find() on a store", {
66
66
  { guid: 4, firstName: "Johnny", lastName: "Cash", married: true },
67
67
  { guid: 5, firstName: "Bert", lastName: "Berthold", married: true }
68
68
  ];
69
-
69
+
70
70
  // load some data
71
71
  MyApp.DataSource.storeKeys = MyApp.store.loadRecords(MyApp.Foo, records);
72
72
  SC.RunLoop.end();
73
-
73
+
74
74
  SC.RunLoop.begin();
75
75
  // for sanity check, load two record types
76
76
  MyApp.store.loadRecords(MyApp.Bar, records);
77
77
  SC.RunLoop.end();
78
-
78
+
79
79
  },
80
-
80
+
81
81
  teardown: function() {
82
82
  MyApp = null ;
83
83
  SC.Record.subclasses.clear(); //reset
84
84
  }
85
-
85
+
86
86
  });
87
87
 
88
88
  // ..........................................................
89
89
  // FINDING SINGLE RECORDS
90
- //
90
+ //
91
91
 
92
92
  test("find(recordType, id)", function() {
93
-
93
+
94
94
  equals(MyApp.store.find('MyApp.Foo', 1).get('firstName'), 'John', 'should return foo(1)');
95
- equals(MyApp.store.find(MyApp.Foo, 1).get('firstName'), 'John', 'should return foo(1)');
95
+ equals(MyApp.store.find(MyApp.Foo, 1).get('firstName'), 'John', 'should return foo(1)');
96
96
  });
97
97
 
98
98
  test("find(record)", function() {
99
-
99
+
100
100
  var rec1 = MyApp.store.find(MyApp.Foo, 1);
101
101
  equals(MyApp.store.find(rec1), rec1, 'find(rec1) should return rec1');
102
-
102
+
103
103
  var rec2 = MyApp.store.chain().find(rec1);
104
104
  ok(rec2 !== rec1, 'nested.find(rec1) should not return same instance');
105
105
  equals(rec2.get('storeKey'), rec1.get('storeKey'), 'nested.find(rec1) should return same record in nested store');
@@ -107,10 +107,10 @@ test("find(record)", function() {
107
107
 
108
108
  // ..........................................................
109
109
  // RECORD ARRAY CACHING
110
- //
111
-
110
+ //
111
+
112
112
  test("caching for a single store", function() {
113
- var r1 = MyApp.store.find(MyApp.Foo);
113
+ var r1 = MyApp.store.find(MyApp.Foo);
114
114
  var r2 = MyApp.store.find(MyApp.Foo);
115
115
  ok(!!r1, 'should return a record array');
116
116
  ok(r1.isEnumerable, 'returned item should be enumerable');
@@ -119,21 +119,21 @@ test("caching for a single store", function() {
119
119
  });
120
120
 
121
121
  test("find() caching for a chained store", function() {
122
- var r1 = MyApp.store.find(MyApp.Foo);
123
-
122
+ var r1 = MyApp.store.find(MyApp.Foo);
123
+
124
124
  var child = MyApp.store.chain();
125
125
  var r2 = child.find(MyApp.Foo);
126
126
  var r3 = child.find(MyApp.Foo);
127
127
 
128
128
  ok(!!r1, 'should return a record array from base store');
129
129
  equals(r1.get('store'), MyApp.store, 'return object should be owned by store');
130
-
130
+
131
131
  ok(!!r2, 'should return a recurd array from child store');
132
132
  equals(r2.get('store'), child, 'return object should be owned by child store');
133
-
133
+
134
134
  ok(r2 !== r1, 'return value for child store should not be same as parent');
135
135
  equals(r3, r2, 'return value from child store should be the same after multiple calls');
136
-
136
+
137
137
  // check underlying queries
138
138
  ok(!!r1.get('query'), 'record array should have a query');
139
139
  equals(r2.get('query'), r1.get('query'), 'record arrays from parent and child stores should share the same query');
@@ -141,8 +141,8 @@ test("find() caching for a chained store", function() {
141
141
 
142
142
  test("data source must get the right calls", function() {
143
143
  var ds = MyApp.store.get('dataSource');
144
-
145
- ds.reset();
144
+
145
+ ds.reset();
146
146
  var records = MyApp.store.find(MyApp.Foo);
147
147
  var q = SC.Query.local(MyApp.Foo);
148
148
  ds.fetchEquals(MyApp.store, q, 'after fetch');
@@ -150,7 +150,7 @@ test("data source must get the right calls", function() {
150
150
 
151
151
  // ..........................................................
152
152
  // RECORD PROPERTIES
153
- //
153
+ //
154
154
 
155
155
  test("should find records based on boolean", function() {
156
156
  SC.RunLoop.begin();
@@ -161,7 +161,7 @@ test("should find records based on boolean", function() {
161
161
  });
162
162
 
163
163
  test("should find records based on query string", function() {
164
-
164
+
165
165
  SC.RunLoop.begin();
166
166
  var q = SC.Query.local(MyApp.Foo, { conditions:"firstName = 'John'" });
167
167
  var records = MyApp.store.find(q);
@@ -172,12 +172,12 @@ test("should find records based on query string", function() {
172
172
 
173
173
  test("should find records based on SC.Query", function() {
174
174
  var q = SC.Query.create({
175
- recordType: MyApp.Foo,
175
+ recordType: MyApp.Foo,
176
176
  conditions:"firstName = 'Jane'"
177
177
  });
178
-
178
+
179
179
  var records = MyApp.store.find(q);
180
-
180
+
181
181
  equals(records.get('length'), 1, 'record length should be 1');
182
182
  equals(records.objectAt(0).get('firstName'), 'Jane', 'name should be Jane');
183
183
  });
@@ -185,10 +185,10 @@ test("should find records based on SC.Query", function() {
185
185
  test("modifying a record should update RecordArray automatically", function() {
186
186
  var q = SC.Query.local(MyApp.Foo, "firstName = 'Jane'"),
187
187
  recs = MyApp.store.find(q);
188
-
188
+
189
189
  equals(recs.get('length'), 1, 'record length should be 1');
190
190
  equals(recs.objectAt(0).get('firstName'), 'Jane', 'name should be Jane');
191
-
191
+
192
192
  SC.RunLoop.begin();
193
193
 
194
194
  var r2 = MyApp.store.find(MyApp.Foo, 3);
@@ -196,84 +196,84 @@ test("modifying a record should update RecordArray automatically", function() {
196
196
  r2.set('firstName', 'Jane');
197
197
 
198
198
  SC.RunLoop.end();
199
-
199
+
200
200
  equals(recs.get('length'), 2, 'record length should increase');
201
201
  same(recs.getEach('firstName'), ['Jane', 'Jane'], 'check all firstNames are Jane');
202
-
202
+
203
203
  // try the other direction...
204
204
  SC.RunLoop.begin();
205
205
  r2.set('firstName', 'Ester');
206
- SC.RunLoop.end();
207
-
206
+ SC.RunLoop.end();
207
+
208
208
  equals(recs.get('length'), 1, 'record length should decrease');
209
209
 
210
210
  });
211
211
 
212
212
  test("should find records based on SC.Query without recordType", function() {
213
-
214
- var q = SC.Query.local(SC.Record, "lastName = 'Doe'");
215
-
213
+
214
+ var q = SC.Query.local(SC.Record, { conditions: "lastName = 'Doe'", orderBy: "firstName" });
215
+
216
216
  var records = MyApp.store.find(q);
217
- equals(records.get('length'), 4, 'record length should be 2');
217
+ equals(records.get('length'), 4, 'record length should be 4');
218
218
 
219
- same(records.getEach('firstName'), 'John John Jane Jane'.w(), 'firstNames should match');
219
+ same(records.getEach('firstName'), 'Jane Jane John John'.w(), 'firstNames should match');
220
220
  });
221
221
 
222
222
  test("should find records within a passed record array", function() {
223
223
 
224
224
  SC.RunLoop.begin();
225
-
226
- var q = SC.Query.create({
227
- recordType: MyApp.Foo,
228
- conditions: "firstName = 'Emily'"
225
+
226
+ var q = SC.Query.create({
227
+ recordType: MyApp.Foo,
228
+ conditions: "firstName = 'Emily'"
229
229
  });
230
230
 
231
231
  var recArray = MyApp.store.find(MyApp.Foo);
232
232
  var records = recArray.find(q);
233
-
233
+
234
234
  equals(records.get('length'), 1, 'record length should be 1');
235
235
  equals(records.objectAt(0).get('firstName'), 'Emily', 'name should be Emily');
236
236
 
237
237
  SC.RunLoop.end();
238
-
238
+
239
239
  });
240
240
 
241
241
  test("sending a new store key array from the data source should update record array", function() {
242
-
242
+
243
243
  var q = SC.Query.remote(MyApp.Foo),
244
244
  records = MyApp.store.find(q);
245
-
245
+
246
246
  SC.RunLoop.begin();
247
247
  equals(records.get('length'), 5, 'record length should be 5');
248
248
  SC.RunLoop.end();
249
-
249
+
250
250
  var newStoreKeys = MyApp.DataSource.storeKeys.copy();
251
251
  newStoreKeys.pop();
252
-
252
+
253
253
  // .replace() will call .enumerableContentDidChange()
254
254
  SC.RunLoop.begin();
255
255
  MyApp.store.loadQueryResults(q, newStoreKeys);
256
256
  SC.RunLoop.end();
257
-
257
+
258
258
  equals(records.get('length'), 4, 'record length should be 4');
259
259
 
260
260
  });
261
261
 
262
262
 
263
263
  test("loading more data into the store should propagate to record array", function() {
264
-
264
+
265
265
  var records = MyApp.store.find(MyApp.Foo);
266
-
266
+
267
267
  equals(records.get('length'), 5, 'record length before should be 5');
268
268
 
269
269
  SC.RunLoop.begin();
270
-
270
+
271
271
  var newStoreKeys = MyApp.store.loadRecords(MyApp.Foo, [
272
272
  { guid: 10, firstName: "John", lastName: "Johnson" }
273
273
  ]);
274
-
274
+
275
275
  SC.RunLoop.end();
276
-
276
+
277
277
  equals(records.get('length'), 6, 'record length after should be 6');
278
278
  });
279
279
 
@@ -281,7 +281,7 @@ test("loading more data into the store should propagate to record array with que
281
281
 
282
282
  var q = SC.Query.local(MyApp.Foo, "firstName = 'John'"),
283
283
  records = MyApp.store.find(q);
284
-
284
+
285
285
  equals(records.get('length'), 1, 'record length before should be 1');
286
286
 
287
287
  SC.RunLoop.begin();
@@ -289,110 +289,110 @@ test("loading more data into the store should propagate to record array with que
289
289
  { guid: 10, firstName: "John", lastName: "Johnson" }
290
290
  ]);
291
291
  SC.RunLoop.end();
292
-
292
+
293
293
  // .replace() will call .enumerableContentDidChange()
294
294
  // and should fire original SC.Query again
295
295
  equals(records.get('length'), 2, 'record length after should be 2');
296
-
296
+
297
297
  // subsequent updates to store keys should also work
298
298
  SC.RunLoop.begin();
299
299
  var newStoreKeys2 = MyApp.store.loadRecords(MyApp.Foo, [
300
300
  { guid: 11, firstName: "John", lastName: "Norman" }
301
301
  ]);
302
302
  SC.RunLoop.end();
303
-
303
+
304
304
  equals(records.get('length'), 3, 'record length after should be 3');
305
305
  });
306
306
 
307
307
  test("Loading records after SC.Query should show up", function() {
308
-
308
+
309
309
  var q = SC.Query.local(MyApp.Foo, "firstName = 'John'"),
310
310
  records = MyApp.store.find(q);
311
-
311
+
312
312
  equals(records.get('length'), 1, 'record length should be 1');
313
313
  equals(records.objectAt(0).get('firstName'), 'John', 'name should be John');
314
-
314
+
315
315
  var recordsToLoad = [
316
316
  { guid: 20, firstName: "John", lastName: "Johnson" },
317
317
  { guid: 21, firstName: "John", lastName: "Anderson" },
318
318
  { guid: 22, firstName: "Barbara", lastName: "Jones" }
319
319
  ];
320
-
320
+
321
321
  SC.RunLoop.begin();
322
322
  MyApp.store.loadRecords(MyApp.Foo, recordsToLoad);
323
323
  SC.RunLoop.end();
324
-
324
+
325
325
  equals(records.get('length'), 3, 'record length should be 3');
326
-
326
+
327
327
  equals(records.objectAt(0).get('firstName'), 'John', 'name should be John');
328
328
  equals(records.objectAt(1).get('firstName'), 'John', 'name should be John');
329
329
  equals(records.objectAt(2).get('firstName'), 'John', 'name should be John');
330
330
  });
331
331
 
332
332
  test("Loading records after getting empty record array based on SC.Query should update", function() {
333
-
333
+
334
334
  var q = SC.Query.local(MyApp.Foo, "firstName = 'Maria'");
335
335
  var records = MyApp.store.find(q);
336
336
  equals(records.get('length'), 0, 'record length should be 0');
337
-
337
+
338
338
  var recordsToLoad = [
339
339
  { guid: 20, firstName: "Maria", lastName: "Johnson" }
340
340
  ];
341
-
341
+
342
342
  SC.RunLoop.begin();
343
343
  MyApp.store.loadRecords(MyApp.Foo, recordsToLoad);
344
344
  SC.RunLoop.end();
345
-
345
+
346
346
  equals(records.get('length'), 1, 'record length should be 1');
347
-
348
- equals(records.objectAt(0).get('firstName'), 'Maria', 'name should be Maria');
347
+
348
+ equals(records.objectAt(0).get('firstName'), 'Maria', 'name should be Maria');
349
349
  });
350
350
 
351
351
  test("Changing a record should make it show up in RecordArrays based on SC.Query", function() {
352
-
352
+
353
353
  var q, records, record;
354
-
354
+
355
355
  q = SC.Query.local(MyApp.Foo, "firstName = 'Maria'");
356
356
  records = MyApp.store.find(q);
357
357
  equals(records.get('length'), 0, 'record length should be 0');
358
-
358
+
359
359
  SC.RunLoop.begin();
360
360
  record = MyApp.store.find(MyApp.Foo, 1);
361
361
  record.set('firstName', 'Maria');
362
362
  SC.RunLoop.end();
363
-
363
+
364
364
  equals(records.get('length'), 1, 'record length should be 1');
365
365
  equals(records.objectAt(0).get('firstName'), 'Maria', 'name should be Maria');
366
366
  });
367
367
 
368
368
  test("Deleting a record should make the RecordArray based on SC.Query update accordingly", function() {
369
-
369
+
370
370
  var q, records;
371
371
 
372
372
  q = SC.Query.local(MyApp.Foo, "firstName = 'John'");
373
373
  records = MyApp.store.find(q);
374
374
  equals(records.get('length'), 1, 'record length should be 1');
375
-
375
+
376
376
  SC.RunLoop.begin();
377
377
  records.objectAt(0).destroy();
378
378
  SC.RunLoop.end();
379
-
379
+
380
380
  equals(records.get('length'), 0, 'record length should be 0');
381
381
  });
382
382
 
383
383
  test("Using find() with SC.Query on store with no data source should work", function() {
384
384
 
385
385
  var q, records, recordsToLoad;
386
-
386
+
387
387
  SC.RunLoop.begin();
388
-
388
+
389
389
  // create a store with no data source
390
390
  MyApp.store3 = SC.Store.create();
391
-
391
+
392
392
  q = SC.Query.local(MyApp.Foo, "firstName = 'John'");
393
393
  records = MyApp.store3.find(q);
394
394
  equals(records.get('length'), 0, 'record length should be 0');
395
-
395
+
396
396
  recordsToLoad = [
397
397
  { guid: 20, firstName: "John", lastName: "Johnson" },
398
398
  { guid: 21, firstName: "John", lastName: "Anderson" },
@@ -400,124 +400,124 @@ test("Using find() with SC.Query on store with no data source should work", func
400
400
  ];
401
401
 
402
402
  MyApp.store3.loadRecords(MyApp.Foo, recordsToLoad);
403
-
403
+
404
404
  SC.RunLoop.end();
405
-
406
- equals(records.get('length'), 2, 'record length should be 2');
405
+
406
+ equals(records.get('length'), 2, 'record length should be 2');
407
407
  });
408
408
 
409
409
  test("Using orderBy in SC.Query returned from find()", function() {
410
-
410
+
411
411
  var q, records;
412
-
412
+
413
413
  q = SC.Query.local(MyApp.Foo, { orderBy: "firstName ASC" });
414
414
  records = MyApp.store.find(q);
415
415
  equals(records.get('length'), 5, 'record length should be 5');
416
-
417
- same(records.getEach('firstName'), ["Bert", "Emily", "Jane", "John", "Johnny"], 'first name should be properly sorted');
416
+
417
+ same(records.getEach('firstName'), ["Bert", "Emily", "Jane", "John", "Johnny"], 'first name should be properly sorted');
418
418
  });
419
419
 
420
420
  test("Using orderBy in SC.Query returned from find() and loading more records to original store key array", function() {
421
421
 
422
422
  var q, records, newStoreKeys2;
423
-
423
+
424
424
  q = SC.Query.local(MyApp.Foo, { orderBy:"firstName ASC" });
425
425
  records = MyApp.store.find(q);
426
426
  equals(records.get('length'), 5, 'record length should be 5');
427
-
427
+
428
428
  equals(records.objectAt(0).get('firstName'), 'Bert', 'name should be Bert');
429
429
  equals(records.objectAt(4).get('firstName'), 'Johnny', 'name should be Johnny');
430
-
430
+
431
431
  SC.RunLoop.begin();
432
432
  newStoreKeys2 = MyApp.store.loadRecords(MyApp.Foo, [
433
433
  { guid: 11, firstName: "Anna", lastName: "Petterson" }
434
434
  ]);
435
435
  SC.RunLoop.end();
436
-
436
+
437
437
  equals(records.objectAt(0).get('firstName'), 'Anna', 'name should be Anna');
438
438
  equals(records.objectAt(1).get('firstName'), 'Bert', 'name should be Bert');
439
439
  equals(records.objectAt(5).get('firstName'), 'Johnny', 'name should be Johnny');
440
-
440
+
441
441
  });
442
442
 
443
443
 
444
444
  test("Using orderBy in SC.Query and loading more records to the store", function() {
445
445
 
446
446
  var q, records;
447
-
447
+
448
448
  SC.RunLoop.begin();
449
449
  q = SC.Query.local(MyApp.Foo, { orderBy:"firstName ASC" });
450
450
  records = MyApp.store.find(q);
451
451
  equals(records.get('length'), 5, 'record length should be 5');
452
452
  equals(records.objectAt(0).get('firstName'), 'Bert', 'name should be Bert');
453
-
453
+
454
454
  MyApp.store.loadRecords(MyApp.Foo, [
455
455
  { guid: 11, firstName: "Anna", lastName: "Petterson" }
456
456
  ]);
457
457
  SC.RunLoop.end();
458
-
458
+
459
459
  equals(records.get('length'), 6, 'record length should be 6');
460
-
460
+
461
461
  equals(records.objectAt(0).get('firstName'), 'Anna', 'name should be Anna');
462
462
  equals(records.objectAt(5).get('firstName'), 'Johnny', 'name should be Johnny');
463
-
463
+
464
464
  });
465
465
 
466
466
  test("Chaining find() queries", function() {
467
-
467
+
468
468
  var q, records, q2, records2;
469
-
469
+
470
470
  q = SC.Query.local(MyApp.Foo, "lastName='Doe'");
471
471
  records = MyApp.store.find(q);
472
472
  equals(records.get('length'), 2, 'record length should be 2');
473
-
473
+
474
474
  q2 = SC.Query.local(MyApp.Foo, "firstName='John'");
475
475
  records2 = records.find(q2);
476
476
 
477
- equals(records2.get('length'), 1, 'record length should be 1');
477
+ equals(records2.get('length'), 1, 'record length should be 1');
478
478
  equals(records2.objectAt(0).get('firstName'), 'John', 'name should be John');
479
-
479
+
480
480
  });
481
481
 
482
482
  test("Chaining find() queries and loading more records", function() {
483
483
 
484
484
  var q, q2, records;
485
-
485
+
486
486
  SC.RunLoop.begin();
487
487
  q = SC.Query.local(MyApp.Foo, "lastName='Doe'");
488
488
  q2 = SC.Query.local(MyApp.Foo, "firstName='John'");
489
-
489
+
490
490
  records = MyApp.store.find(q).find(q2);
491
491
  equals(records.get('length'), 1, 'record length should be 1');
492
-
492
+
493
493
  MyApp.store.loadRecords(MyApp.Foo, [
494
494
  { guid: 11, firstName: "John", lastName: "Doe" }
495
495
  ]);
496
496
  SC.RunLoop.end();
497
-
498
- equals(records.get('length'), 2, 'record length should be 2');
497
+
498
+ equals(records.get('length'), 2, 'record length should be 2');
499
499
  });
500
500
 
501
501
 
502
502
  module("create record");
503
-
503
+
504
504
  test("creating record appears in future find()", function() {
505
505
  var Rec, store, r;
506
-
506
+
507
507
  Rec = SC.Record.extend({ title: SC.Record.attr(String) });
508
508
  store = SC.Store.create();
509
-
509
+
510
510
  SC.run(function() {
511
- store.loadRecords(Rec,
512
- [ { title: "A", guid: 1 },
511
+ store.loadRecords(Rec,
512
+ [ { title: "A", guid: 1 },
513
513
  { title: "B", guid: 2 } ]);
514
514
  });
515
-
515
+
516
516
  equals(store.find(Rec).get('length'), 2, 'should have two initial record');
517
517
 
518
518
  SC.run(function() {
519
519
  store.createRecord(Rec, { title: "C" });
520
-
520
+
521
521
  // NOTE: calling find() here should flush changes to the record arrays
522
522
  // so that find() always returns an accurate result
523
523
  r = store.find(Rec);
@@ -525,6 +525,6 @@ test("creating record appears in future find()", function() {
525
525
  });
526
526
 
527
527
  r = store.find(Rec);
528
- equals(r.get('length'), 3, 'should return additional record');
528
+ equals(r.get('length'), 3, 'should return additional record');
529
529
  });
530
530