sproutcore 1.5.0-java → 1.6.0.beta.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (301) hide show
  1. data/.mailmap +32 -0
  2. data/CHANGELOG +15 -0
  3. data/Rakefile +18 -0
  4. data/VERSION.yml +2 -2
  5. data/bin/sc-build +0 -5
  6. data/bin/sc-build-number +0 -5
  7. data/bin/sc-docs +0 -5
  8. data/bin/sc-gen +0 -5
  9. data/bin/sc-init +0 -5
  10. data/bin/sc-manifest +0 -5
  11. data/bin/sc-server +0 -5
  12. data/bin/sproutcore +0 -5
  13. data/lib/frameworks/sproutcore/Buildfile +3 -3
  14. data/lib/frameworks/sproutcore/CHANGELOG.md +21 -0
  15. data/lib/frameworks/sproutcore/README.md +77 -7
  16. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +0 -2
  17. data/lib/frameworks/sproutcore/frameworks/animation/core.js +3 -2
  18. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +1 -1
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +1 -17
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +1 -1
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +4 -4
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +49 -0
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +23 -21
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +1 -1
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +36 -1
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +126 -7
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +3 -3
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +13 -1
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +2 -2
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +16 -16
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +1 -34
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +29 -23
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -4
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +20 -23
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +78 -0
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/checkbox_support.js +26 -0
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +115 -1
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +55 -0
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +49 -1
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +19 -1
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +1 -0
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +2 -0
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +38 -41
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +4 -3
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1 -0
  48. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +7 -82
  49. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +12 -5
  50. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +1 -1
  51. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/array_observers.js +82 -0
  52. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +17 -0
  53. data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
  54. data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +1 -1
  55. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +2 -2
  56. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +33 -30
  57. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +12 -11
  58. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +7 -7
  59. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +4 -4
  60. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +20 -20
  61. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +5 -5
  62. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +10 -10
  63. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +24 -23
  64. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +51 -54
  65. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +3 -3
  66. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
  67. data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +29 -29
  68. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +1 -1
  69. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +3 -3
  70. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +6 -6
  71. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +4 -4
  72. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +5 -5
  73. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +1 -1
  74. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +5 -5
  75. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +7 -7
  76. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +3 -3
  77. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +7 -5
  78. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +31 -31
  79. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +1 -1
  80. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +35 -29
  81. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +2 -2
  82. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +61 -50
  83. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
  84. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +2 -2
  85. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -1
  86. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +1 -1
  87. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
  88. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/coders/object.js +12 -12
  89. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/controllers/designs.js +6 -6
  90. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/controllers/page_files.js +1 -1
  91. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/css/css_style_sheet.js +7 -9
  92. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/object_designer.js +13 -13
  93. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +37 -37
  94. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/ext/object.js +3 -2
  95. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/ext/page.js +2 -2
  96. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/ext/view.js +4 -3
  97. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/mixins/snap_lines.js +7 -6
  98. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/designer_drop_target.js +3 -3
  99. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/drawing.js +49 -42
  100. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/high_light.js +1 -1
  101. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/page_item_view.js +6 -6
  102. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +1 -1
  103. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/english.lproj/default_styles.css +0 -0
  104. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/english.lproj/strings.js +0 -0
  105. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/mixins/edit_mode.js +0 -0
  106. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/mixins/emptiness.js +0 -0
  107. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/render_delegates/form.js +0 -0
  108. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/render_delegates/form_row.js +0 -0
  109. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form.js +0 -0
  110. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_checkbox_field.js +0 -0
  111. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_field.js +0 -0
  112. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_label.js +0 -0
  113. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_radio_field.js +0 -0
  114. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_row.js +0 -0
  115. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/tests/views/form_text_field.js +0 -0
  116. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/views/form.js +13 -14
  117. data/lib/frameworks/sproutcore/frameworks/{forms → experimental/frameworks/forms}/views/form_row.js +0 -0
  118. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +4 -6
  119. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -1
  120. data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +2 -4
  121. data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +8 -12
  122. data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +28 -34
  123. data/lib/frameworks/sproutcore/frameworks/{foundation → routing}/system/routes.js +31 -47
  124. data/lib/frameworks/sproutcore/frameworks/{foundation → routing}/tests/system/routes.js +0 -0
  125. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  126. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +15 -21
  127. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +8 -0
  128. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +3 -3
  129. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array_observers.js +23 -0
  130. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +1 -1
  131. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/contains.js +3 -3
  132. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/intersects.js +3 -3
  133. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +66 -133
  134. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +68 -139
  135. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +11 -11
  136. data/lib/frameworks/sproutcore/frameworks/testing/system/suite.js +23 -29
  137. data/lib/frameworks/sproutcore/lib/index.rhtml +5 -2
  138. data/lib/sproutcore.rb +2 -9
  139. data/lib/sproutcore/builders/minify.rb +5 -5
  140. data/lib/sproutcore/helpers/minifier.rb +6 -10
  141. data/lib/sproutcore/models/target.rb +2 -2
  142. data/lib/sproutcore/rack/proxy.rb +8 -7
  143. data/lib/sproutcore/tools.rb +16 -5
  144. data/spec/lib/builders/html_spec.rb +5 -5
  145. data/sproutcore.gemspec +11 -5
  146. data/vendor/chance/lib/chance.rb +4 -2
  147. data/{lib/sproutcore/vendor → vendor}/jsdoc/README.txt +0 -0
  148. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame.js +0 -0
  149. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Chain.js +0 -0
  150. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Dumper.js +0 -0
  151. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Hash.js +0 -0
  152. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Link.js +0 -0
  153. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Namespace.js +0 -0
  154. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Opt.js +0 -0
  155. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Reflection.js +0 -0
  156. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/String.js +0 -0
  157. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/frame/Testrun.js +0 -0
  158. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/handlers/FOODOC.js +0 -0
  159. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/handlers/XMLDOC.js +0 -0
  160. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/handlers/XMLDOC/DomReader.js +0 -0
  161. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/handlers/XMLDOC/XMLDoc.js +0 -0
  162. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/handlers/XMLDOC/XMLParse.js +0 -0
  163. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC.js +0 -0
  164. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/DocComment.js +0 -0
  165. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/DocTag.js +0 -0
  166. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/JsDoc.js +0 -0
  167. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/JsPlate.js +0 -0
  168. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Lang.js +0 -0
  169. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Parser.js +0 -0
  170. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/PluginManager.js +0 -0
  171. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Symbol.js +0 -0
  172. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -0
  173. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/TextStream.js +0 -0
  174. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Token.js +0 -0
  175. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/TokenReader.js +0 -0
  176. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/TokenStream.js +0 -0
  177. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Util.js +0 -0
  178. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/lib/JSDOC/Walker.js +0 -0
  179. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/main.js +0 -0
  180. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/commentSrcJson.js +0 -0
  181. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/frameworkPrototype.js +0 -0
  182. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/functionCall.js +0 -0
  183. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/publishSrcHilite.js +0 -0
  184. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/sproutcoreTags.js +0 -0
  185. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/symbolLink.js +0 -0
  186. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/tagParamConfig.js +0 -0
  187. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/plugins/tagSynonyms.js +0 -0
  188. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/run.js +0 -0
  189. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/t/TestDoc.js +0 -0
  190. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/t/runner.js +0 -0
  191. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test.js +0 -0
  192. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/addon.js +0 -0
  193. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/anon_inner.js +0 -0
  194. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/augments.js +0 -0
  195. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/augments2.js +0 -0
  196. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/borrows.js +0 -0
  197. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/borrows2.js +0 -0
  198. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/config.js +0 -0
  199. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/constructs.js +0 -0
  200. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/encoding.js +0 -0
  201. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/encoding_other.js +0 -0
  202. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/functions_anon.js +0 -0
  203. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/functions_nested.js +0 -0
  204. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/global.js +0 -0
  205. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/globals.js +0 -0
  206. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/ignore.js +0 -0
  207. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/inner.js +0 -0
  208. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/jsdoc_test.js +0 -0
  209. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/lend.js +0 -0
  210. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/memberof.js +0 -0
  211. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/memberof_constructor.js +0 -0
  212. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/name.js +0 -0
  213. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/namespace_nested.js +0 -0
  214. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/nocode.js +0 -0
  215. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/oblit_anon.js +0 -0
  216. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/overview.js +0 -0
  217. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/param_inline.js +0 -0
  218. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/params_optional.js +0 -0
  219. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/prototype.js +0 -0
  220. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/prototype_nested.js +0 -0
  221. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/prototype_oblit.js +0 -0
  222. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/prototype_oblit_constructor.js +0 -0
  223. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/public.js +0 -0
  224. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/shared.js +0 -0
  225. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/shared2.js +0 -0
  226. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/shortcuts.js +0 -0
  227. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/static_this.js +0 -0
  228. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/synonyms.js +0 -0
  229. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/tosource.js +0 -0
  230. data/{lib/sproutcore/vendor → vendor}/jsdoc/app/test/variable_redefine.js +0 -0
  231. data/{lib/sproutcore/vendor → vendor}/jsdoc/changes.txt +0 -0
  232. data/{lib/sproutcore/vendor → vendor}/jsdoc/conf/sample.conf +0 -0
  233. data/{lib/sproutcore/vendor → vendor}/jsdoc/java/build.xml +0 -0
  234. data/{lib/sproutcore/vendor → vendor}/jsdoc/java/build_1.4.xml +0 -0
  235. data/{lib/sproutcore/vendor → vendor}/jsdoc/java/classes/js.jar +0 -0
  236. data/{lib/sproutcore/vendor → vendor}/jsdoc/java/src/JsDebugRun.java +0 -0
  237. data/{lib/sproutcore/vendor → vendor}/jsdoc/java/src/JsRun.java +0 -0
  238. data/{lib/sproutcore/vendor → vendor}/jsdoc/jsdebug.jar +0 -0
  239. data/{lib/sproutcore/vendor → vendor}/jsdoc/jsrun.jar +0 -0
  240. data/{lib/sproutcore/vendor → vendor}/jsdoc/t/TestDoc.js +0 -0
  241. data/{lib/sproutcore/vendor → vendor}/jsdoc/t/runner.js +0 -0
  242. data/{lib/sproutcore/vendor → vendor}/jsdoc/test.js +0 -0
  243. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/addon.js +0 -0
  244. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/anon_inner.js +0 -0
  245. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/augments.js +0 -0
  246. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/augments2.js +0 -0
  247. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/borrows.js +0 -0
  248. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/borrows2.js +0 -0
  249. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/config.js +0 -0
  250. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/constructs.js +0 -0
  251. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/encoding.js +0 -0
  252. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/encoding_other.js +0 -0
  253. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/functions_anon.js +0 -0
  254. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/functions_nested.js +0 -0
  255. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/global.js +0 -0
  256. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/globals.js +0 -0
  257. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/ignore.js +0 -0
  258. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/inner.js +0 -0
  259. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/jsdoc_test.js +0 -0
  260. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/lend.js +0 -0
  261. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/memberof.js +0 -0
  262. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/memberof_constructor.js +0 -0
  263. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/name.js +0 -0
  264. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/namespace_nested.js +0 -0
  265. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/nocode.js +0 -0
  266. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/oblit_anon.js +0 -0
  267. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/overview.js +0 -0
  268. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/param_inline.js +0 -0
  269. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/params_optional.js +0 -0
  270. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/prototype.js +0 -0
  271. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/prototype_nested.js +0 -0
  272. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/prototype_oblit.js +0 -0
  273. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/prototype_oblit_constructor.js +0 -0
  274. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/public.js +0 -0
  275. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/shared.js +0 -0
  276. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/shared2.js +0 -0
  277. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/shortcuts.js +0 -0
  278. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/static_this.js +0 -0
  279. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/synonyms.js +0 -0
  280. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/tosource.js +0 -0
  281. data/{lib/sproutcore/vendor → vendor}/jsdoc/test/variable_redefine.js +0 -0
  282. data/vendor/sproutcore/{src/SCCompiler/lib/yuicompressor-2.4.4.jar → lib/yuicompressor-2.4.6.jar} +0 -0
  283. metadata +169 -178
  284. data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +0 -148
  285. data/lib/sproutcore/vendor/github_gem_lint.rb +0 -22
  286. data/vendor/sproutcore/SCCompiler.jar +0 -0
  287. data/vendor/sproutcore/lib/args4j-2.0.12.jar +0 -0
  288. data/vendor/sproutcore/lib/yuicompressor-2.4.2.jar +0 -0
  289. data/vendor/sproutcore/src/SCCompiler/build.xml +0 -74
  290. data/vendor/sproutcore/src/SCCompiler/lib/args4j-2.0.12.jar +0 -0
  291. data/vendor/sproutcore/src/SCCompiler/lib/htmlcompressor-0.9.3.jar +0 -0
  292. data/vendor/sproutcore/src/SCCompiler/lib/yuicompressor-2.4.2.jar +0 -0
  293. data/vendor/sproutcore/src/SCCompiler/manifest.mf +0 -3
  294. data/vendor/sproutcore/src/SCCompiler/nbproject/build-impl.xml +0 -894
  295. data/vendor/sproutcore/src/SCCompiler/nbproject/genfiles.properties +0 -8
  296. data/vendor/sproutcore/src/SCCompiler/nbproject/private/config.properties +0 -0
  297. data/vendor/sproutcore/src/SCCompiler/nbproject/private/private.properties +0 -10
  298. data/vendor/sproutcore/src/SCCompiler/nbproject/private/private.xml +0 -4
  299. data/vendor/sproutcore/src/SCCompiler/nbproject/project.properties +0 -90
  300. data/vendor/sproutcore/src/SCCompiler/nbproject/project.xml +0 -15
  301. data/vendor/sproutcore/src/SCCompiler/src/com/sproutcore/Main.java +0 -348
@@ -37,8 +37,8 @@ SC.platform = SC.Object.create({
37
37
 
38
38
  /*
39
39
  NOTES
40
- - A development version of Chrome 9 incorrectly reported supporting touch
41
- - Android is assumed to support touch, but incorrectly reports that it does not
40
+ - A development version of Chrome 9 incorrectly reported supporting touch
41
+ - Android is assumed to support touch, but incorrectly reports that it does not
42
42
  */
43
43
  /**
44
44
  YES if the current device supports touch events, NO otherwise.
@@ -259,40 +259,7 @@ SC.RenderContext = SC.Builder.create(/** SC.RenderContext.fn */ {
259
259
  @returns {DOMElement} the element
260
260
  */
261
261
  element: function() {
262
- if (this._elem) return this._elem;
263
-
264
- // create factory div if needed
265
- var K = SC.RenderContext,
266
- factory = K.factory,
267
- ret, child;
268
-
269
- if (!factory) {
270
- factory = K.factory = document.createElement('div');
271
- }
272
- factory.innerHTML = this.join();
273
-
274
- // In IE something weird happens when reusing the same element.
275
- // After setting innerHTML, the innerHTML of the element in the previous
276
- // view turns blank. It seems that there is something weird with their
277
- // garbage collection algorithm. I tried just removing the nodes after
278
- // keeping a reference to the first child, but it didn't work. I ended
279
- // up cloning the first child.
280
- if (SC.browser.msie) {
281
- if (factory.innerHTML.length > 0) {
282
- child = factory.firstChild.cloneNode(true);
283
- factory.innerHTML = '';
284
- }
285
- else {
286
- child = null;
287
- }
288
- }
289
- else {
290
- // Faster path (avoiding the unnecessary node clone) for non-IE
291
- // browsers.
292
- child = factory.firstChild;
293
- }
294
-
295
- return child ;
262
+ return this._elem ? this._elem : SC.$(this.join())[0]
296
263
  },
297
264
 
298
265
  /**
@@ -18,7 +18,7 @@ SC.CAPTURE_BACKSPACE_KEY = NO ;
18
18
  RootResponder directly. Instead you will work with Pane objects, which
19
19
  register themselves with the RootResponder as needed to receive events.
20
20
 
21
- h1. RootResponder and Platforms
21
+ ## RootResponder and Platforms
22
22
 
23
23
  RootResponder contains core functionality common among the different web
24
24
  platforms. You will likely be working with a subclass of RootResponder that
@@ -27,24 +27,24 @@ SC.CAPTURE_BACKSPACE_KEY = NO ;
27
27
  The correct instance of RootResponder is detected at runtime and loaded
28
28
  transparently.
29
29
 
30
- h1. Event Types
30
+ ## Event Types
31
31
 
32
32
  RootResponders can route four types of events:
33
33
 
34
- - Direct events, such as mouse and touch events. These are routed to the
35
- nearest view managing the target DOM elment. RootResponder also handles
36
- multitouch events so that they are delegated to the correct views.
37
- - Keyboard events. These are sent to the keyPane, which will then send the
38
- event to the current firstResponder and up the responder chain.
39
- - Resize events. When the viewport resizes, these events will be sent to all
40
- panes.
41
- - Keyboard shortcuts. Shortcuts are sent to the keyPane first, which
42
- will go down its view hierarchy. Then they go to the mainPane, which will
43
- go down its view hierarchy.
44
- - Actions. Actions are generic messages that your application can send in
45
- response to user action or other events. You can either specify an
46
- explicit target, or allow the action to traverse the hierarchy until a
47
- view is found that handles it.
34
+ - Direct events, such as mouse and touch events. These are routed to the
35
+ nearest view managing the target DOM elment. RootResponder also handles
36
+ multitouch events so that they are delegated to the correct views.
37
+ - Keyboard events. These are sent to the keyPane, which will then send the
38
+ event to the current firstResponder and up the responder chain.
39
+ - Resize events. When the viewport resizes, these events will be sent to all
40
+ panes.
41
+ - Keyboard shortcuts. Shortcuts are sent to the keyPane first, which
42
+ will go down its view hierarchy. Then they go to the mainPane, which will
43
+ go down its view hierarchy.
44
+ - Actions. Actions are generic messages that your application can send in
45
+ response to user action or other events. You can either specify an
46
+ explicit target, or allow the action to traverse the hierarchy until a
47
+ view is found that handles it.
48
48
  */
49
49
  SC.RootResponder = SC.Object.extend({
50
50
 
@@ -406,7 +406,7 @@ SC.RootResponder = SC.Object.extend({
406
406
  the action name you pass to this method. Set 'target' to null to search
407
407
  the responder chain.
408
408
 
409
- IMPORTANT: This method's API and implementation will likely change
409
+ **IMPORTANT**: This method's API and implementation will likely change
410
410
  significantly after SproutCore 1.0 to match the version found in
411
411
  SC.ResponderContext.
412
412
 
@@ -959,7 +959,8 @@ SC.RootResponder = SC.Object.extend({
959
959
  for instance, prevent scrolling in a ScrollView, you need to make sure to transfer control
960
960
  back to the previous responder:
961
961
 
962
- if (Math.abs(touch.pageY - touch.startY) > this.MAX_SWIPE) touch.restoreLastTouchResponder();
962
+ if (Math.abs(touch.pageY - touch.startY) > this.MAX_SWIPE)
963
+ touch.restoreLastTouchResponder();
963
964
 
964
965
  You don't call makeTouchResponder on RootResponder directly. Instead, it gets called for you
965
966
  when you return YES to captureTouch or touchStart.
@@ -968,14 +969,19 @@ SC.RootResponder = SC.Object.extend({
968
969
  a button view inside a ScrollView: if the touch moves too much, the button should give control back
969
970
  to the scroll view.
970
971
 
971
- if (Math.abs(touch.pageX - touch.startX) > 4) {
972
- if (touch.nextTouchResponder) touch.makeTouchResponder(touch.nextTouchResponder);
973
- }
972
+ if (Math.abs(touch.pageX - touch.startX) > 4) {
973
+ if (touch.nextTouchResponder)
974
+ touch.makeTouchResponder(touch.nextTouchResponder);
975
+ }
974
976
 
975
977
  This will give control back to the containing view. Maybe you only want to do it if it is a ScrollView?
976
978
 
977
- if (Math.abs(touch.pageX - touch.startX) > 4 && touch.nextTouchResponder && touch.nextTouchResponder.isScrollable)
978
- touch.makeTouchResponder(touch.nextTouchResponder);
979
+ if (
980
+ Math.abs(touch.pageX - touch.startX) > 4 &&
981
+ touch.nextTouchResponder &&
982
+ touch.nextTouchResponder.isScrollable
983
+ )
984
+ touch.makeTouchResponder(touch.nextTouchResponder);
979
985
 
980
986
  Possible gotcha: while you can do touch.nextTouchResponder, the responders are not chained in a linked list like
981
987
  normal responders, because each touch has its own responder stack. To navigate through the stack (or, though
@@ -73,10 +73,12 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
73
73
  @returns {SC.SparseArray} receiver
74
74
  */
75
75
  provideLength: function(length) {
76
+ var oldLength;
76
77
  if (SC.none(length)) this._sa_content = null ;
77
78
  if (length !== this._length) {
79
+ oldLength = this._length;
78
80
  this._length = length ;
79
- if (this._requestingLength <= 0) this.enumerableContentDidChange() ;
81
+ if (this._requestingLength <= 0) { this.arrayContentDidChange(0, oldLength||0, length||0) ; }
80
82
  }
81
83
  return this ;
82
84
  },
@@ -256,7 +258,7 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
256
258
  if (!content) content = this._sa_content = [] ;
257
259
  var start = range.start, len = range.length;
258
260
  while(--len >= 0) content[start+len] = array.objectAt(len);
259
- if (this._requestingIndex <= 0) this.enumerableContentDidChange(range.start, range.length);
261
+ if (this._requestingIndex <= 0) this.arrayContentDidChange(range.start, range.length, range.length);
260
262
  return this ;
261
263
  },
262
264
 
@@ -299,7 +301,7 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
299
301
  while (--loc>=start) content[loc] = undefined;
300
302
  }
301
303
  }
302
- this.enumerableContentDidChange(range.start, range.length) ; // notify
304
+ this.arrayContentDidChange(range.start, range.length, range.length) ; // notify
303
305
  return this ;
304
306
  },
305
307
 
@@ -376,9 +378,11 @@ SC.SparseArray = SC.Object.extend(SC.Observable, SC.Enumerable, SC.Array,
376
378
  @returns {SC.SparseArray} receiver
377
379
  */
378
380
  reset: function() {
381
+ var oldLength;
379
382
  this._sa_content = null ;
383
+ oldLength = this._length;
380
384
  this._length = null ;
381
- this.enumerableContentDidChange() ;
385
+ this.arrayContentDidChange(0, oldLength, 0);
382
386
  this.invokeDelegateMethod(this.delegate, 'sparseArrayDidReset', this);
383
387
  return this ;
384
388
  }
@@ -32,13 +32,12 @@ SC.mixin(SC.String, {
32
32
  /**
33
33
  Capitalizes a string.
34
34
 
35
- h2. Examples
35
+ ## Examples
36
36
 
37
- | *Input String* | *Output String* |
38
- | my favorite items | My favorite items |
39
- | css-class-name | Css-class-name |
40
- | action_name | Action_name |
41
- | innerHTML | InnerHTML |
37
+ capitalize('my favorite items') // 'My favorite items'
38
+ capitalize('css-class-name') // 'Css-class-name'
39
+ capitalize('action_name') // 'Action_name'
40
+ capitalize('innerHTML') // 'InnerHTML'
42
41
 
43
42
  @return {String} capitalized string
44
43
  */
@@ -50,13 +49,12 @@ SC.mixin(SC.String, {
50
49
  Camelizes a string. This will take any words separated by spaces, dashes
51
50
  or underscores and convert them into camelCase.
52
51
 
53
- h2. Examples
52
+ ## Examples
54
53
 
55
- | *Input String* | *Output String* |
56
- | my favorite items | myFavoriteItems |
57
- | css-class-name | cssClassName |
58
- | action_name | actionName |
59
- | innerHTML | innerHTML |
54
+ camelize('my favorite items') // 'myFavoriteItems'
55
+ camelize('css-class-name') // 'cssClassName'
56
+ camelize('action_name') // 'actionName'
57
+ camelize('innerHTML') // 'innerHTML'
60
58
 
61
59
  @returns {String} camelized string
62
60
  */
@@ -74,13 +72,12 @@ SC.mixin(SC.String, {
74
72
  /**
75
73
  Converts a camelized string into all lower case separated by underscores.
76
74
 
77
- h2. Examples
75
+ ## Examples
78
76
 
79
- | *Input String* | *Output String* |
80
- | my favorite items | my favorite items |
81
- | css-class-name | css-class-name |
82
- | action_name | action_name |
83
- | innerHTML | inner_html |
77
+ decamelize('my favorite items') // 'my favorite items'
78
+ decamelize('css-class-name') // 'css-class-name'
79
+ decamelize('action_name') // 'action_name'
80
+ decamelize('innerHTML') // 'inner_html'
84
81
 
85
82
  @returns {String} the decamelized string.
86
83
  */
@@ -92,13 +89,13 @@ SC.mixin(SC.String, {
92
89
  Converts a camelized string or a string with spaces or underscores into
93
90
  a string with components separated by dashes.
94
91
 
95
- h2. Examples
92
+ ## Examples
96
93
 
97
94
  | *Input String* | *Output String* |
98
- | my favorite items | my-favorite-items |
99
- | css-class-name | css-class-name |
100
- | action_name | action-name |
101
- | innerHTML | inner-html |
95
+ dasherize('my favorite items') // 'my-favorite-items'
96
+ dasherize('css-class-name') // 'css-class-name'
97
+ dasherize('action_name') // 'action-name'
98
+ dasherize('innerHTML') // 'inner-html'
102
99
 
103
100
  @returns {String} the dasherized string.
104
101
  */
@@ -0,0 +1,78 @@
1
+ var button;
2
+
3
+ module("SC.Button", {
4
+ setup: function() {
5
+ button = SC.Button.create();
6
+
7
+ pane = SC.MainPane.create({
8
+ childViews: [button]
9
+ });
10
+ pane.append();
11
+ },
12
+
13
+ teardown: function() {
14
+ pane.remove();
15
+ }
16
+ });
17
+
18
+ function synthesizeEvent(type, view) {
19
+ var event = new SC.Event({
20
+ type: type,
21
+ target: view.get('layer')
22
+ });
23
+ SC.RootResponder.responder[type](event);
24
+ }
25
+
26
+ test("should trigger an action when clicked", function() {
27
+ var wasClicked = false;
28
+
29
+ var actionObject = SC.Object.create({
30
+ myAction: function() {
31
+ wasClicked = true;
32
+ }
33
+ });
34
+
35
+ button.target = actionObject;
36
+ button.action = 'myAction';
37
+
38
+ synthesizeEvent('mousedown', button);
39
+ synthesizeEvent('mouseup', button);
40
+
41
+ ok(wasClicked);
42
+ });
43
+
44
+ test("should not trigger action if mouse leaves area before mouseup", function() {
45
+ var wasClicked = false;
46
+
47
+ var actionObject = SC.Object.create({
48
+ myAction: function() {
49
+ wasClicked = true;
50
+ }
51
+ });
52
+
53
+ var otherButton = SC.Button.create();
54
+ pane.appendChild(otherButton);
55
+
56
+ button.target = actionObject;
57
+ button.action = 'myAction';
58
+
59
+ synthesizeEvent('mousedown', button);
60
+ synthesizeEvent('mousemove', button);
61
+ ok(button.get('isActive'), "becomes active when hovered");
62
+ synthesizeEvent('mousemove', otherButton);
63
+ ok(!button.get('isActive'), "loses active state if mouse exits");
64
+ synthesizeEvent('mouseup', button);
65
+
66
+ ok(!wasClicked);
67
+
68
+ wasClicked = false;
69
+
70
+ synthesizeEvent('mousedown', button);
71
+ synthesizeEvent('mousemove', button);
72
+ synthesizeEvent('mousemove', otherButton);
73
+ synthesizeEvent('mousemove', button);
74
+ synthesizeEvent('mouseup', button);
75
+
76
+ ok(wasClicked);
77
+ });
78
+
@@ -34,5 +34,31 @@
34
34
  checkboxView.set('value', true);
35
35
  ok(checkboxView.$('input').attr("checked"), "sets value of DOM to value property");
36
36
  });
37
+
38
+ module("SC.Checkbox", {
39
+ setup: function() {
40
+ checkboxView = SC.Checkbox.create({});
41
+
42
+ pane = SC.MainPane.create({
43
+ childViews: [checkboxView]
44
+ });
45
+ pane.append();
46
+ },
47
+
48
+ teardown: function() {
49
+ pane.remove();
50
+ }
51
+ });
52
+
53
+ test("value property mirrors input value", function() {
54
+ checkboxView.$('input').attr('checked', true);
55
+
56
+ equals(checkboxView.get('value'), true, "gets value property from DOM");
57
+
58
+ checkboxView.$('input').attr('checked', false);
59
+
60
+ checkboxView.set('value', true);
61
+ ok(checkboxView.$('input').attr("checked"), "sets value of DOM to value property");
62
+ });
37
63
  })();
38
64
 
@@ -5,10 +5,14 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
  (function() {
8
- var textFieldView, pane;
8
+ var TestObject, textFieldView, pane;
9
9
 
10
10
  module("Text Field Support", {
11
11
  setup: function() {
12
+ TestObject = window.TestObject = SC.Object.create({
13
+ value: null
14
+ });
15
+
12
16
  textFieldView = SC.TemplateView.create(SC.TextFieldSupport, {
13
17
  template: SC.Handlebars.compile('<input type="text">')
14
18
  });
@@ -21,6 +25,7 @@
21
25
 
22
26
  teardown: function() {
23
27
  pane.remove();
28
+ TestObject = window.TestObject = textFieldView = pane = null;
24
29
  }
25
30
  });
26
31
 
@@ -33,6 +38,25 @@
33
38
  equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
34
39
  });
35
40
 
41
+ test("value binding works properly for inputs that haven't been created", function() {
42
+ var view = SC.TemplateView.create(SC.TextFieldSupport, {
43
+ template: SC.Handlebars.compile('<input type="text">'),
44
+ valueBinding: 'TestObject.value'
45
+ });
46
+
47
+ equals(view.get('value'), null, "precond - default value is null");
48
+ equals(view.$('input').length, 0, "precond - view doesn't have its layer created yet, thus no input element");
49
+
50
+ SC.run(function() { TestObject.set('value', 'ohai'); });
51
+
52
+ equals(view.get('value'), 'ohai', "value property was properly updated");
53
+
54
+ SC.run(function() { pane.appendChild(view); });
55
+
56
+ equals(view.get('value'), 'ohai', "value property remains the same once the view has been appended");
57
+ equals(view.$('input').val(), 'ohai', "value is reflected in the input element once it is created");
58
+ });
59
+
36
60
  test("listens for focus and blur events", function() {
37
61
  var focusCalled = 0;
38
62
  var blurCalled = 0;
@@ -76,4 +100,94 @@
76
100
  equals(cancelCalled, 1, "calls cancel after pressing escape key");
77
101
 
78
102
  });
103
+
104
+ module("SC.TextField", {
105
+ setup: function() {
106
+ TestObject = window.TestObject = SC.Object.create({
107
+ value: null
108
+ });
109
+
110
+ textFieldView = SC.TextField.create();
111
+
112
+ pane = SC.MainPane.create({
113
+ childViews: [textFieldView]
114
+ });
115
+ pane.append();
116
+ },
117
+
118
+ teardown: function() {
119
+ pane.remove();
120
+ TestObject = window.TestObject = textFieldView = pane = null;
121
+ }
122
+ });
123
+
124
+ test("value property mirrors input value", function() {
125
+ textFieldView.$('input').val('foo bar');
126
+
127
+ equals(textFieldView.get('value'), 'foo bar', "gets value property from DOM");
128
+
129
+ textFieldView.set('value', "afterlife");
130
+ equals(textFieldView.$('input').val(), "afterlife", "sets value of DOM to value property");
131
+ });
132
+
133
+ test("value binding works properly for inputs that haven't been created", function() {
134
+ var view = SC.TextField.create({
135
+ valueBinding: 'TestObject.value'
136
+ });
137
+
138
+ equals(view.get('value'), null, "precond - default value is null");
139
+ equals(view.$('input').length, 0, "precond - view doesn't have its layer created yet, thus no input element");
140
+
141
+ SC.run(function() { TestObject.set('value', 'ohai'); });
142
+
143
+ equals(view.get('value'), 'ohai', "value property was properly updated");
144
+
145
+ SC.run(function() { pane.appendChild(view); });
146
+
147
+ equals(view.get('value'), 'ohai', "value property remains the same once the view has been appended");
148
+ equals(view.$('input').val(), 'ohai', "value is reflected in the input element once it is created");
149
+ });
150
+
151
+ test("listens for focus and blur events", function() {
152
+ var focusCalled = 0;
153
+ var blurCalled = 0;
154
+
155
+ textFieldView.focus = function() {
156
+ focusCalled++;
157
+ };
158
+ textFieldView.blur = function() {
159
+ blurCalled++;
160
+ };
161
+
162
+ equals(focusCalled+blurCalled, 0, "precond - no callbacks called yet");
163
+
164
+ textFieldView.$('input').focus();
165
+ equals(focusCalled, 1, "focus called after field receives focus");
166
+
167
+ textFieldView.$('input').blur();
168
+ equals(blurCalled, 1, "blur alled after field blurs");
169
+ });
170
+
171
+ test("calls correct method for key events", function() {
172
+ var insertNewlineCalled = 0;
173
+ var cancelCalled = 0;
174
+
175
+ textFieldView.insertNewline = function() {
176
+ insertNewlineCalled++;
177
+ return YES;
178
+ };
179
+ textFieldView.cancel = function() {
180
+ cancelCalled++;
181
+ return YES;
182
+ };
183
+
184
+ textFieldView.$('input').focus();
185
+ equals(insertNewlineCalled+cancelCalled, 0, "precond - no callbacks called yet");
186
+
187
+ SC.RootResponder.responder.keyup(new SC.Event({ type: 'keyup', keyCode: 13 }));
188
+ equals(insertNewlineCalled, 1, "calls insertNewline after hitting return");
189
+
190
+ SC.RootResponder.responder.keyup(new SC.Event({ type: 'keyup', keyCode: 27 }));
191
+ equals(cancelCalled, 1, "calls cancel after pressing escape key");
192
+ });
79
193
  })();