sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32

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 (209) hide show
  1. data/CHANGELOG +12 -0
  2. data/VERSION.yml +1 -1
  3. data/bin/sc-docs +6 -1
  4. data/lib/buildtasks/target.rake +1 -1
  5. data/lib/frameworks/sproutcore/Buildfile +5 -1
  6. data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
  7. data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
  8. data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
  9. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
  10. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
  39. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
  40. data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
  41. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
  42. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
  43. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
  44. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
  45. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
  46. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
  47. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
  48. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
  49. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
  50. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
  51. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
  52. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
  53. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
  54. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
  55. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
  56. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
  57. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
  58. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
  59. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
  60. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
  61. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
  62. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
  63. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
  64. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
  65. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
  66. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
  67. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
  68. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
  69. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
  70. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
  71. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
  72. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
  73. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
  74. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
  75. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
  76. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
  77. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
  78. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
  79. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
  80. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
  81. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
  82. data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
  83. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
  84. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
  85. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
  86. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
  87. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
  88. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
  89. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
  90. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
  91. data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
  92. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
  93. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
  94. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
  95. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
  96. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
  97. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
  98. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
  99. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
  100. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
  101. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
  102. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
  103. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
  104. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
  105. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
  106. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
  107. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
  108. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
  109. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
  110. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
  111. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
  112. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
  113. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
  114. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
  115. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
  116. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
  117. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
  118. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
  119. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
  120. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
  121. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
  122. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
  123. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
  124. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
  125. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
  126. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
  127. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
  128. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
  129. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
  130. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
  131. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
  132. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
  133. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
  134. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
  135. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
  136. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
  137. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
  138. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
  139. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
  140. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
  141. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
  142. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
  143. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
  144. data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
  146. data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
  147. data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
  148. data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
  149. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
  150. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
  151. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
  152. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
  153. data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
  154. data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
  155. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
  156. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
  157. data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
  158. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
  159. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
  160. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
  161. data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
  162. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
  163. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
  164. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
  165. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
  166. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
  167. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
  168. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
  169. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
  170. data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
  171. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
  172. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
  173. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
  174. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
  175. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
  176. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
  177. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
  178. data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
  179. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
  180. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
  181. data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
  182. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
  183. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
  184. data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
  185. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
  186. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
  187. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
  188. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
  189. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
  190. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
  191. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
  192. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
  193. data/lib/sproutcore/builders/base.rb +5 -1
  194. data/lib/sproutcore/builders/handlebars.rb +12 -1
  195. data/lib/sproutcore/models/target.rb +1 -9
  196. data/lib/sproutcore/rack/proxy.rb +238 -92
  197. data/lib/sproutcore/tools/docs.rb +1 -7
  198. data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
  199. data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
  200. data/spec/lib/builders/handlebars_spec.rb +10 -4
  201. data/sproutcore.gemspec +3 -1
  202. metadata +73 -44
  203. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
  204. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
  205. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
  206. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
  207. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
  208. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
  209. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
@@ -0,0 +1,14 @@
1
+ // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
2
+ // Portions ©2008-2011 Apple Inc. All rights reserved.
3
+ // License: Licensed under MIT license (see license.js)
4
+ // ==========================================================================
5
+
6
+ /**
7
+ @class
8
+ Renders and updates the DOM representation of a SelectView.
9
+ */
10
+ SC.BaseTheme.selectRenderDelegate = SC.BaseTheme.buttonRenderDelegate.create({
11
+ menuLeftOffset: -3,
12
+ menuTopOffset: 2,
13
+ menuMinimumWidthOffset: -18
14
+ });
@@ -0,0 +1,25 @@
1
+ module("Menus -- Automatic Resizing");
2
+
3
+ function createMenu(items) {
4
+ return SC.MenuPane.create({
5
+ items: items
6
+ });
7
+ }
8
+
9
+ test("Different widths for different sets of items", function() {
10
+ SC.RunLoop.begin();
11
+ var menu1 = createMenu("A B C D E F G".w());
12
+ menu1.popup();
13
+
14
+ var menu2 = createMenu("HelloY'allVeryLongThing World".w());
15
+ menu2.popup();
16
+ SC.RunLoop.end();
17
+
18
+ var w1 = menu1.get('layout').width;
19
+ var w2 = menu2.get('layout').width;
20
+
21
+ ok(w2 > w1, "Menu 2 should be wider than Menu 1");
22
+
23
+ menu1.remove();
24
+ menu2.remove();
25
+ });
@@ -0,0 +1,43 @@
1
+ module("SelectViewMenu -- Bindings");
2
+
3
+ function setValues(obj, props, toValue) {
4
+ for (var idx = 0; idx < props.length; idx++) {
5
+ obj.set(props[idx], toValue);
6
+ }
7
+ }
8
+
9
+ function validateValues(obj, props, value) {
10
+ for (var idx = 0; idx < props.length; idx++) {
11
+ equals(obj.get(props[idx]), value);
12
+ }
13
+ }
14
+
15
+ test("Proxying all properties from SelectView to MenuView works.", function() {
16
+ var proxyProperties = [
17
+ 'items',
18
+ 'itemTitleKey', 'itemIsEnabledKey', 'itemValueKey', 'itemIconKey',
19
+ 'itemHeightKey', 'itemSubMenuKey', 'itemSeparatorKey', 'itemTargetKey',
20
+ 'itemActionKey', 'itemCheckboxKey', 'itemShortCutKey',
21
+ 'itemKeyEquivalentKey', 'itemDisableMenuFlashKey',
22
+
23
+ 'preferType', 'preferMatrix'
24
+ ];
25
+
26
+ var obj = SC.Object.create({});
27
+ setValues(obj, proxyProperties, 'initial');
28
+
29
+ // Bindings won't evaluate until the end of the run loop, so make a run loop
30
+ SC.RunLoop.begin();
31
+ var menu = SC.Object.create(SC.SelectViewMenu, { selectView: obj });
32
+ SC.RunLoop.end();
33
+
34
+ // test that initial binding worked
35
+ validateValues(menu, proxyProperties, 'initial');
36
+
37
+ // now, test updates
38
+ SC.RunLoop.begin();
39
+ setValues(obj, proxyProperties, 'modified');
40
+ SC.RunLoop.end();
41
+
42
+ validateValues(menu, proxyProperties, 'modified');
43
+ });
@@ -0,0 +1,32 @@
1
+ // The second responsibility of SC.SelectViewMenu is to make sure the selected
2
+ // item is checked.
3
+
4
+ module("SelectViewMenu -- Check Selected");
5
+
6
+ test("Selected menu item is checked", function() {
7
+ SC.RunLoop.begin();
8
+ var selectView = SC.Object.create({
9
+ value: "A"
10
+ });
11
+
12
+ var menu = SC.MenuPane.create(SC.SelectViewMenu, {
13
+ items: "A B C D E".w(),
14
+ selectView: selectView
15
+ });
16
+
17
+ menu.popup();
18
+ SC.RunLoop.end();
19
+
20
+
21
+ equals(menu.get('menuItemViews')[0].get('isChecked'), YES, "First menu item is checked");
22
+
23
+ SC.RunLoop.begin();
24
+ selectView.set('value', 'C');
25
+ SC.RunLoop.end();
26
+
27
+ equals(menu.get('menuItemViews')[0].get('isChecked'), NO, "First menu item is checked");
28
+ equals(menu.get('menuItemViews')[2].get('isChecked'), YES, "Third menu item is checked");
29
+
30
+
31
+ menu.remove();
32
+ });
@@ -0,0 +1,40 @@
1
+ module("PopupButtonView -- Menu Setup");
2
+
3
+
4
+ test("Setting up menu without background task queue", function() {
5
+ SC.RunLoop.begin();
6
+ var popup = SC.PopupButtonView.create({
7
+ menu: SC.MenuPane.extend({
8
+ items: "1 2 3 4 5".w()
9
+ })
10
+ });
11
+ SC.RunLoop.end();
12
+
13
+ equals(popup.get('menu').isClass, YES, "Menu not yet instantiated");
14
+
15
+ SC.RunLoop.begin();
16
+ popup.setupMenu();
17
+ SC.RunLoop.end();
18
+
19
+ equals(popup.get('menu').isClass, undefined, "Menu now instantiated");
20
+
21
+ });
22
+
23
+ test("Setting up in background task queue", function() {
24
+ SC.RunLoop.begin();
25
+ var popup = SC.PopupButtonView.create({
26
+ shouldLoadInBackground: YES,
27
+ menu: SC.MenuPane.extend({
28
+ items: "1 2 3 4 5".w()
29
+ })
30
+ });
31
+ SC.RunLoop.end();
32
+
33
+ equals(popup.get('menu').isClass, YES, "Menu not yet instantiated");
34
+
35
+ SC.RunLoop.begin();
36
+ SC.backgroundTaskQueue.run();
37
+ SC.RunLoop.end();
38
+
39
+ equals(popup.get('menu').isClass, undefined, "Menu now instantiated");
40
+ });
@@ -0,0 +1,45 @@
1
+ module("PopupButtonView -- Showing menu");
2
+
3
+ test("Popping up the menu will set the preferMatrix", function() {
4
+ SC.RunLoop.begin();
5
+ var popup = SC.PopupButtonView.create({
6
+ menu: SC.MenuPane.extend({
7
+ items: "1 2 3 4 5".w()
8
+ }),
9
+
10
+ menuPreferMatrix: [1, 2, 3]
11
+ });
12
+ popup.showMenu();
13
+ SC.RunLoop.end();
14
+
15
+ same(popup.get('menu').get('preferMatrix'), [1, 2, 3], "Prefer Matrix is same.");
16
+
17
+ popup.hideMenu();
18
+ });
19
+
20
+ test("Showing the menu activates the button.", function() {
21
+ SC.RunLoop.begin();
22
+ var popup = SC.PopupButtonView.create({
23
+ menu: SC.MenuPane.extend({
24
+ items: "1 2 3 4 5".w()
25
+ }),
26
+
27
+ menuPreferMatrix: [1, 2, 3]
28
+ });
29
+ SC.RunLoop.end();
30
+
31
+ equals(popup.get('isActive'), NO, "Is not active at startup.");
32
+
33
+ SC.RunLoop.begin();
34
+ popup.showMenu();
35
+ SC.RunLoop.end();
36
+
37
+ equals(popup.get('isActive'), YES, "Is active when menu is open.");
38
+
39
+ SC.RunLoop.begin();
40
+ popup.hideMenu();
41
+ SC.RunLoop.end();
42
+
43
+ equals(popup.get('isActive'), NO, "Is not active once menu closes.");
44
+ });
45
+
@@ -0,0 +1,49 @@
1
+ // Tests that the minimum menu width changes with the size of the SelectView
2
+ //
3
+ var View, pane, obj;
4
+
5
+ module("SelectView - Minimum Menu Width", {
6
+ setup: function() {
7
+ pane = SC.Pane.create();
8
+
9
+ obj = SC.Object.create({title: 'Lost', value: 'Found'});
10
+
11
+ View = SC.SelectView.extend({
12
+ items: [
13
+ {title: 'Hello', value: 'hi'},
14
+ {title: 'Yo', value: 'Jimbo'},
15
+ ],
16
+
17
+ itemTitleKey: 'title',
18
+ itemValueKey: 'value'
19
+ });
20
+ },
21
+
22
+ teardown: function() {
23
+
24
+ }
25
+ });
26
+
27
+ function createView(settings) {
28
+ var view = View.create(settings || {});
29
+ pane.appendChild(view);
30
+ return view;
31
+ }
32
+
33
+ test("Menu width changes with minimumMenuWidth", function() {
34
+ SC.RunLoop.begin();
35
+ var view = createView({ minimumMenuWidth: 500 });
36
+ view.showMenu();
37
+ SC.RunLoop.end();
38
+
39
+ equals(view.get('menu').get('frame').width, 500, "Width is 500");
40
+
41
+ SC.RunLoop.begin();
42
+ view.set('minimumMenuWidth', 1000);
43
+ SC.RunLoop.end();
44
+
45
+ equals(view.get('menu').get('frame').width, 1000, "Width has changed to 1000");
46
+
47
+ view.hideMenu();
48
+
49
+ });
@@ -0,0 +1,191 @@
1
+ // Tests:
2
+ // - defaultTitle
3
+ // - title comes from selected item
4
+ // - value changing changes selected item
5
+ var View, pane, obj;
6
+
7
+ module("SelectView - Selected Item", {
8
+ setup: function() {
9
+ pane = SC.Pane.create();
10
+
11
+ obj = SC.Object.create({title: 'Lost', value: 'Found'});
12
+
13
+ View = SC.SelectView.extend({
14
+ items: [
15
+ {title: 'Hello', value: 'hi'},
16
+ {title: 'Yo', value: 'Jimbo'},
17
+ obj,
18
+ {title: 'The Greate American Flee Market', value: 'aFilm'}
19
+ ],
20
+
21
+ itemTitleKey: 'title',
22
+ itemValueKey: 'value'
23
+ });
24
+ },
25
+
26
+ teardown: function() {
27
+
28
+ }
29
+ });
30
+
31
+ function createView(settings) {
32
+ var view = View.create(settings || {});
33
+ pane.appendChild(view);
34
+ return view;
35
+ }
36
+
37
+ test("defaultTitle used when no item is selected", function() {
38
+ SC.RunLoop.begin();
39
+ var view = createView({ defaultTitle: "Bonjour" });
40
+ SC.RunLoop.end();
41
+
42
+ equals(view.get('title'), "Bonjour", "Title is the default title");
43
+ });
44
+
45
+ test("defaultTitle is NOT used when an item IS selected at startup", function() {
46
+ SC.RunLoop.begin();
47
+ var view = createView({ defaultTitle: "Bonjour", value: 'Jimbo' });
48
+ SC.RunLoop.end();
49
+
50
+ equals(view.get('title'), "Yo", "Title comes from selected item");
51
+
52
+ });
53
+
54
+ test("title changes when selected item changes", function() {
55
+ SC.RunLoop.begin();
56
+ var view = createView({ defaultTitle: "Bonjour", value: 'Jimbo' });
57
+ SC.RunLoop.end();
58
+
59
+ equals(view.get('title'), "Yo", "Initial title comes from selected item");
60
+
61
+ SC.RunLoop.begin();
62
+
63
+ // the actual item is an SC.Object. However, MenuPane's selected item will not be
64
+ // the original, so we do in fact need to test that it works even when the "selected
65
+ // item" is not the exact same object.
66
+ view.set('selectedItem', {title: 'Lost', value: 'Found'});
67
+ SC.RunLoop.end();
68
+
69
+ equals(view.get('title'), "Lost", "Title changed");
70
+
71
+ });
72
+
73
+ test("title reverts to defaultTitle when item is deselected", function() {
74
+ SC.RunLoop.begin();
75
+ var view = createView({ defaultTitle: "Bonjour" });
76
+ SC.RunLoop.end();
77
+
78
+ equals(view.get('title'), "Bonjour", "Initial title comes from default title");
79
+
80
+ SC.RunLoop.begin();
81
+ view.set('selectedItem', {title: 'Lost', value: 'Found'});
82
+ SC.RunLoop.end();
83
+
84
+ equals(view.get('title'), "Lost", "Title changed");
85
+
86
+ // now the real test: changing back
87
+ SC.RunLoop.begin();
88
+ view.set('selectedItem', null);
89
+ SC.RunLoop.end();
90
+
91
+ equals(view.get('title'), "Bonjour", "Back to defaultTitle");
92
+ });
93
+
94
+ test("changing value changes the selected item", function() {
95
+ SC.RunLoop.begin();
96
+ var view = createView({ defaultTitle: "Bonjour" });
97
+ SC.RunLoop.end();
98
+
99
+ equals(view.get('selectedItem'), null, "Selected item starts at null");
100
+
101
+ SC.RunLoop.begin();
102
+ view.set('value', "Jimbo");
103
+ SC.RunLoop.end();
104
+
105
+ ok(view.get('selectedItem') !== null, "Selected item is no longer null");
106
+ equals(view.get('title'), "Yo", "Title has changed");
107
+ });
108
+
109
+ test("changing value to a value not in the list deselects", function() {
110
+ SC.RunLoop.begin();
111
+ var view = createView({ defaultTitle: "Bonjour" });
112
+ SC.RunLoop.end();
113
+
114
+ equals(view.get('selectedItem'), null, "Selected item starts at null");
115
+
116
+ SC.RunLoop.begin();
117
+ view.set('value', "Jimbo");
118
+ SC.RunLoop.end();
119
+
120
+ ok(view.get('selectedItem') !== null, "Selected item is no longer null");
121
+ equals(view.get('title'), "Yo", "Title has changed");
122
+
123
+ SC.RunLoop.begin();
124
+ view.set('value', "NOT THE ITEM YOU ARE LOOKING FOR");
125
+ SC.RunLoop.end();
126
+
127
+ equals(view.get('selectedItem'), null, "No item selected anymore");
128
+ equals(view.get('title'), "Bonjour", "Back to default title");
129
+ });
130
+
131
+ test("title changes when an SC.Object item's title changes", function() {
132
+ SC.RunLoop.begin();
133
+ var view = createView({ value: "Found" });
134
+ SC.RunLoop.end();
135
+
136
+ equals(view.get('title'), "Lost", "Title starts at that of selected item");
137
+
138
+ SC.RunLoop.begin();
139
+ obj.set('title', "Found");
140
+ SC.RunLoop.end();
141
+
142
+ equals(view.get('title'), "Found", "Title has changed");
143
+
144
+ });
145
+
146
+ test("value changes when an SC.Object item's value changes", function() {
147
+ SC.RunLoop.begin();
148
+ var view = createView({ value: "Found" });
149
+ SC.RunLoop.end();
150
+
151
+ equals(view.get('value'), "Found", "Title starts at that of selected item");
152
+
153
+ SC.RunLoop.begin();
154
+ obj.set('value', "Yo");
155
+ SC.RunLoop.end();
156
+
157
+ equals(view.get('value'), "Yo", "Title has changed");
158
+
159
+ });
160
+
161
+ test("value does not change when an SC.Object item's value changes when that item is not selected", function() {
162
+ SC.RunLoop.begin();
163
+ var view = createView({ value: "Found" });
164
+ SC.RunLoop.end();
165
+
166
+ equals(view.get('value'), "Found", "Title starts at that of selected item");
167
+
168
+ SC.RunLoop.begin();
169
+ obj.set('value', "Yo");
170
+ SC.RunLoop.end();
171
+
172
+ equals(view.get('value'), "Yo", "Title has changed");
173
+
174
+ SC.RunLoop.begin();
175
+ view.set('value', "Jimbo");
176
+ SC.RunLoop.end();
177
+
178
+ equals(view.get('value'), "Jimbo", "Value changed");
179
+ equals(view.get('title'), "Yo", "Title changed");
180
+
181
+ SC.RunLoop.begin();
182
+ obj.set('value', "Something else");
183
+ SC.RunLoop.end();
184
+
185
+ equals(view.get('value'), "Jimbo", "Value has not changed");
186
+ equals(view.get('title'), "Yo", "Title has not changed");
187
+
188
+ });
189
+
190
+
191
+