sproutcore 1.5.0.pre.3 → 1.5.0.pre.4
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.
- data/.rspec +1 -0
- data/CHANGELOG +42 -0
- data/README.txt +25 -0
- data/VERSION.yml +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-build-number +1 -1
- data/bin/sc-docs +1 -1
- data/bin/sc-gen +1 -1
- data/bin/sc-init +1 -1
- data/bin/sc-manifest +1 -1
- data/bin/sc-server +1 -1
- data/bin/sproutcore +1 -1
- data/lib/buildtasks/build.rake +5 -0
- data/lib/buildtasks/manifest.rake +20 -1
- data/lib/frameworks/sproutcore/Buildfile +12 -9
- data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
- data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
- data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
- data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
- data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
- data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
- data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
- data/lib/gen/html_app/Buildfile +36 -0
- data/lib/gen/html_app/README +1 -0
- data/lib/gen/html_app/USAGE +15 -0
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
- data/lib/gen/html_project/Buildfile +45 -0
- data/lib/gen/html_project/INIT +3 -0
- data/lib/gen/html_project/README +1 -0
- data/lib/gen/html_project/USAGE +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
- data/lib/gen/html_project/templates/@filename@/README +7 -0
- data/lib/sproutcore/builders/handlebars.rb +30 -0
- data/lib/sproutcore/builders.rb +1 -1
- data/lib/sproutcore/helpers/static_helper.rb +3 -3
- data/lib/sproutcore/tools/init.rb +25 -9
- data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
- data/spec/lib/builders/handlebars_spec.rb +29 -0
- data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
- data/vendor/chance/lib/chance/instance.rb +4 -1
- data/vendor/chance/lib/chance/parser.rb +31 -31
- data/vendor/chance/lib/chance/slicing.rb +38 -8
- metadata +195 -225
- data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
- data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +0 -105
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// ==========================================================================
|
|
2
|
-
// Project: SproutCore - JavaScript Application Framework
|
|
3
|
-
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
|
4
|
-
// Portions ©2008-2010 Apple Inc. All rights reserved.
|
|
5
|
-
// License: Licensed under MIT license (see license.js)
|
|
6
|
-
// ==========================================================================
|
|
7
|
-
|
|
8
|
-
require('system/ready');
|
|
9
|
-
require('system/root_responder');
|
|
10
|
-
require('system/platform');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
The device object allows you to check device specific properties such as
|
|
14
|
-
orientation and if the device is offline, as well as observe when they change
|
|
15
|
-
state.
|
|
16
|
-
|
|
17
|
-
h1. Orientation
|
|
18
|
-
When a touch device changes orientation, the orientation property will be
|
|
19
|
-
set accordingly which you can observe
|
|
20
|
-
|
|
21
|
-
h1. Offline support
|
|
22
|
-
In order to build a good offline-capable web application, you need to know
|
|
23
|
-
when your app has gone offline so you can for instance queue your server
|
|
24
|
-
requests for a later time or provide a specific UI/message.
|
|
25
|
-
|
|
26
|
-
Similarly, you also need to know when your application has returned to an
|
|
27
|
-
'online' state again, so that you can re-synchronize with the server or do
|
|
28
|
-
anything else that might be needed.
|
|
29
|
-
|
|
30
|
-
By observing the 'isOffline' property you can be notified when this state
|
|
31
|
-
changes. Note that this property is only connected to the navigator.onLine
|
|
32
|
-
property, which is available on most modern browsers.
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
SC.device = SC.Object.create({
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
Sets the orientation for touch devices, either 'landscape' or 'portrait'.
|
|
39
|
-
Will be 'desktop' in the case of non-touch devices.
|
|
40
|
-
|
|
41
|
-
@property {String}
|
|
42
|
-
@default 'desktop'
|
|
43
|
-
*/
|
|
44
|
-
orientation: 'desktop',
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
Indicates whether the device is currently online or offline. For browsers
|
|
48
|
-
that do not support this feature, the default value is NO.
|
|
49
|
-
|
|
50
|
-
Is currently inverse of the navigator.onLine property. Most modern browsers
|
|
51
|
-
will update this property when switching to or from the browser's Offline
|
|
52
|
-
mode, and when losing/regaining network connectivity.
|
|
53
|
-
|
|
54
|
-
@property {Boolean}
|
|
55
|
-
@default NO
|
|
56
|
-
*/
|
|
57
|
-
isOffline: NO,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
Returns a Point containing the last known X and Y coordinates of the
|
|
61
|
-
mouse, if present.
|
|
62
|
-
|
|
63
|
-
@property {Point}
|
|
64
|
-
*/
|
|
65
|
-
mouseLocation: function() {
|
|
66
|
-
var responder = SC.RootResponder.responder,
|
|
67
|
-
lastX = responder._lastMoveX,
|
|
68
|
-
lastY = responder._lastMoveY;
|
|
69
|
-
|
|
70
|
-
if (SC.empty(lastX) || SC.empty(lastY)) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return { x: lastX, y: lastY };
|
|
75
|
-
}.property(),
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
Initialize the object with some properties up front
|
|
79
|
-
*/
|
|
80
|
-
init: function() {
|
|
81
|
-
sc_super();
|
|
82
|
-
if(SC.platform.touch) this.orientationchange();
|
|
83
|
-
|
|
84
|
-
if(navigator && navigator.onLine===false) {
|
|
85
|
-
this.set('isOffline', YES);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.panes = SC.Set.create();
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
As soon as the DOM is up and running, make sure we attach necessary
|
|
93
|
-
event handlers
|
|
94
|
-
*/
|
|
95
|
-
setup: function() {
|
|
96
|
-
var responder = SC.RootResponder.responder;
|
|
97
|
-
responder.listenFor('orientationchange'.w(), window, this);
|
|
98
|
-
responder.listenFor('online offline'.w(), document, this);
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
// ..........................................................
|
|
102
|
-
// EVENT HANDLING
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
orientationchange: function(evt) {
|
|
106
|
-
if(window.orientation===0 || window.orientation===180) {
|
|
107
|
-
this.set('orientation', 'portrait');
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
this.set('orientation', 'landscape');
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
orientationObserver: function(){
|
|
115
|
-
var body = SC.$(document.body),
|
|
116
|
-
or = this.get('orientation');
|
|
117
|
-
if(or === "portrait") {
|
|
118
|
-
body.setClass('portrait', YES);
|
|
119
|
-
body.setClass('landscape', NO);
|
|
120
|
-
}
|
|
121
|
-
if( or === "landscape" ) {
|
|
122
|
-
body.setClass('portrait', NO);
|
|
123
|
-
body.setClass('landscape', YES);
|
|
124
|
-
}
|
|
125
|
-
}.observes('orientation'),
|
|
126
|
-
|
|
127
|
-
online: function(evt) {
|
|
128
|
-
this.set('isOffline', NO);
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
offline: function(evt) {
|
|
132
|
-
this.set('isOffline', YES);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
/*
|
|
138
|
-
Invoked when the document is ready, but before main is called. Creates
|
|
139
|
-
an instance and sets up event listeners as needed.
|
|
140
|
-
*/
|
|
141
|
-
SC.ready(function() {
|
|
142
|
-
SC.device.setup() ;
|
|
143
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// ==========================================================================
|
|
2
|
-
// Project: SproutCore - JavaScript Application Framework
|
|
3
|
-
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
|
4
|
-
// Portions ©2008-2010 Apple Inc. All rights reserved.
|
|
5
|
-
// License: Licensed under MIT license (see license.js)
|
|
6
|
-
// ==========================================================================
|
|
7
|
-
|
|
8
|
-
// These are helpful utility functions for calculating range and rect values
|
|
9
|
-
sc_require('system/browser');
|
|
10
|
-
|
|
11
|
-
SC.mixin( /** @scope SC */ {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
Takes a URL of any type and normalizes it into a fully qualified URL with
|
|
15
|
-
hostname. For example:
|
|
16
|
-
|
|
17
|
-
{{{
|
|
18
|
-
"some/path" => "http://localhost:4020/some/path"
|
|
19
|
-
"/some/path" => "http://localhost:4020/some/path"
|
|
20
|
-
"http://localhost:4020/some/path" => "http://localhost:4020/some/path"
|
|
21
|
-
}}}
|
|
22
|
-
|
|
23
|
-
@param url {String} the URL
|
|
24
|
-
@returns {String} the normalized URL
|
|
25
|
-
*/
|
|
26
|
-
normalizeURL: function(url) {
|
|
27
|
-
if (url.slice(0,1) == '/') {
|
|
28
|
-
url = window.location.protocol + '//' + window.location.host + url ;
|
|
29
|
-
} else if ((url.slice(0,5) == 'http:') || (url.slice(0,6) == 'https:')) {
|
|
30
|
-
// no change
|
|
31
|
-
} else {
|
|
32
|
-
url = window.location.href + '/' + url ;
|
|
33
|
-
}
|
|
34
|
-
return url ;
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
/** Return true if the number is between 0 and 1 */
|
|
38
|
-
isPercentage: function(val){
|
|
39
|
-
return (val<1 && val>0);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
/** Return the left edge of the frame */
|
|
43
|
-
minX: function(frame) {
|
|
44
|
-
return frame.x || 0;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
/** Return the right edge of the frame. */
|
|
48
|
-
maxX: function(frame) {
|
|
49
|
-
return (frame.x || 0) + (frame.width || 0);
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
/** Return the midpoint of the frame. */
|
|
53
|
-
midX: function(frame) {
|
|
54
|
-
return (frame.x || 0) + ((frame.width || 0) / 2) ;
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
/** Return the top edge of the frame */
|
|
58
|
-
minY: function(frame) {
|
|
59
|
-
return frame.y || 0 ;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
/** Return the bottom edge of the frame */
|
|
63
|
-
maxY: function(frame) {
|
|
64
|
-
return (frame.y || 0) + (frame.height || 0) ;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/** Return the midpoint of the frame */
|
|
68
|
-
midY: function(frame) {
|
|
69
|
-
return (frame.y || 0) + ((frame.height || 0) / 2) ;
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
/** Returns the point that will center the frame X within the passed frame. */
|
|
73
|
-
centerX: function(innerFrame, outerFrame) {
|
|
74
|
-
return (outerFrame.width - innerFrame.width) / 2 ;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/** Return the point that will center the frame Y within the passed frame. */
|
|
78
|
-
centerY: function(innerFrame, outerFrame) {
|
|
79
|
-
return (outerFrame.height - innerFrame.height) /2 ;
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
/** Finds the absolute viewportOffset for a given element.
|
|
83
|
-
This method is more accurate than the version provided by prototype.
|
|
84
|
-
|
|
85
|
-
If you pass NULL to this method, it will return a { x:0, y:0 }
|
|
86
|
-
@param el The DOM element
|
|
87
|
-
@returns {Point} A hash with x,y offsets.
|
|
88
|
-
*/
|
|
89
|
-
viewportOffset: function(el) {
|
|
90
|
-
// Some browsers natively implement getBoundingClientRect, so if it's
|
|
91
|
-
// available we'll use it for speed.
|
|
92
|
-
if (el.getBoundingClientRect) {
|
|
93
|
-
var boundingRect = el.getBoundingClientRect(),
|
|
94
|
-
isIOS41 = false;
|
|
95
|
-
// we need to detect the mobileSafari build number in the userAgent.
|
|
96
|
-
// The webkit versions are the same but the results returned by getBoundingClientRect
|
|
97
|
-
// are very different one includes the scrolling from the top of the document , the other
|
|
98
|
-
// doesnt
|
|
99
|
-
if (SC.browser.mobileSafari){
|
|
100
|
-
var userAgent = navigator.userAgent,
|
|
101
|
-
index = userAgent.indexOf('Mobile/'),
|
|
102
|
-
mobileBuildNumber = userAgent.substring(index+7, index+9);
|
|
103
|
-
if (mobileBuildNumber > "8A") isIOS41 = true;
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (SC.browser.mobileSafari && (parseInt(SC.browser.mobileSafari, 0)>532 || isIOS41)) {
|
|
108
|
-
return { x:boundingRect.left+(window.pageXOffset || 0), y:boundingRect.top+(window.pageYOffset || 0) };
|
|
109
|
-
}
|
|
110
|
-
else{
|
|
111
|
-
return { x:boundingRect.left, y:boundingRect.top };
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var valueL = 0, valueT = 0, cqElement, overflow, left, top, offsetParent,
|
|
116
|
-
element = el, isFirefox3 = SC.browser.mozilla >= 3 ;
|
|
117
|
-
// add up all the offsets for the element.
|
|
118
|
-
|
|
119
|
-
while (element) {
|
|
120
|
-
cqElement = SC.$(element);
|
|
121
|
-
valueT += (element.offsetTop || 0);
|
|
122
|
-
if (!isFirefox3 || (element !== el)) {
|
|
123
|
-
valueT += (element.clientTop || 0);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
valueL += (element.offsetLeft || 0);
|
|
127
|
-
if (!isFirefox3 || (element !== el)) {
|
|
128
|
-
valueL += (element.clientLeft || 0);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// bizarely for FireFox if your offsetParent has a border, then it can
|
|
132
|
-
// impact the offset.
|
|
133
|
-
if (SC.browser.mozilla) {
|
|
134
|
-
overflow = cqElement.attr('overflow') ;
|
|
135
|
-
if (overflow !== 'visible') {
|
|
136
|
-
left = parseInt(cqElement.attr('borderLeftWidth'),0) || 0 ;
|
|
137
|
-
top = parseInt(cqElement.attr('borderTopWidth'),0) || 0 ;
|
|
138
|
-
if (el !== element) {
|
|
139
|
-
left *= 2; top *= 2 ;
|
|
140
|
-
}
|
|
141
|
-
valueL += left; valueT += top ;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// In FireFox 3 -- the offsetTop/offsetLeft subtracts the clientTop/
|
|
145
|
-
// clientLeft of the offset parent.
|
|
146
|
-
offsetParent = element.offsetParent ;
|
|
147
|
-
if (SC.browser.mozilla.match(/1[.]9/) && offsetParent) {
|
|
148
|
-
valueT -= offsetParent.clientTop ;
|
|
149
|
-
valueL -= offsetParent.clientLeft;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Safari fix
|
|
154
|
-
if (element.offsetParent == document.body &&
|
|
155
|
-
cqElement.attr('position') === 'absolute') break;
|
|
156
|
-
|
|
157
|
-
element = element.offsetParent ;
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
element = el;
|
|
162
|
-
while (element) {
|
|
163
|
-
if (!SC.browser.isOpera || element.tagName === 'BODY') {
|
|
164
|
-
valueT -= element.scrollTop || 0;
|
|
165
|
-
valueL -= element.scrollLeft || 0;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
element = element.parentNode ;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return { x: valueL, y: valueT } ;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}) ;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// ========================================================================
|
|
2
|
-
// MainPane Unit Tests
|
|
3
|
-
// ========================================================================
|
|
4
|
-
/*globals module test ok isObj equals expects */
|
|
5
|
-
|
|
6
|
-
// ..........................................................
|
|
7
|
-
// BASE TESTS
|
|
8
|
-
//
|
|
9
|
-
// These tests exercise the API. See below for tests that cover edge
|
|
10
|
-
// conditions. If you find a bug, we recommend that you add a test in the
|
|
11
|
-
// edge case section.
|
|
12
|
-
|
|
13
|
-
var FRAME = { x: 10, y: 10, width: 30, height: 30 } ;
|
|
14
|
-
|
|
15
|
-
var pane, view ; // test globals
|
|
16
|
-
|
|
17
|
-
module('SC.MainPane');
|
|
18
|
-
|
|
19
|
-
test("should attach when calling append()", function() {
|
|
20
|
-
var pane = SC.MainPane.create() ;
|
|
21
|
-
pane.append() ;
|
|
22
|
-
equals(pane.get('isPaneAttached'), YES) ;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test("appending should make pane main & key", function() {
|
|
26
|
-
var pane = SC.MainPane.create() ;
|
|
27
|
-
pane.append();
|
|
28
|
-
var r = pane.get('rootResponder');
|
|
29
|
-
equals(r.get('mainPane'), pane, 'should become mainPane');
|
|
30
|
-
equals(r.get('keyPane'), pane, 'should become keyPane');
|
|
31
|
-
});
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
// ==========================================================================
|
|
2
|
-
// Project: SproutCore - JavaScript Application Framework
|
|
3
|
-
// Copyright: ©2006-2010 Apple Inc. and contributors.
|
|
4
|
-
// License: Licensed under MIT license (see license.js)
|
|
5
|
-
// ==========================================================================
|
|
6
|
-
|
|
7
|
-
/*global module test equals context ok same Q$ htmlbody */
|
|
8
|
-
var pane, fooView, barView, defaultResponder, evt, callCount ;
|
|
9
|
-
var handlerYes, handlerNo, handlerMixed;
|
|
10
|
-
|
|
11
|
-
module("SC.Pane#sendTouchEvent - single view", {
|
|
12
|
-
setup: function() {
|
|
13
|
-
|
|
14
|
-
callCount = 0;
|
|
15
|
-
var handler = function(theEvent) {
|
|
16
|
-
callCount++ ;
|
|
17
|
-
equals(theEvent, evt, 'should pass event');
|
|
18
|
-
return YES;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
defaultResponder = SC.Object.create({ defaultEvent: handler });
|
|
22
|
-
pane = SC.Pane.create({
|
|
23
|
-
defaultResponder: defaultResponder,
|
|
24
|
-
childViews: [SC.View.extend({
|
|
25
|
-
fooEvent: handler,
|
|
26
|
-
childViews: [SC.View.extend({
|
|
27
|
-
barEvent: handler
|
|
28
|
-
})]
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
fooView = pane.childViews[0];
|
|
32
|
-
ok(fooView.fooEvent, 'has fooEvent handler');
|
|
33
|
-
|
|
34
|
-
barView = fooView.childViews[0];
|
|
35
|
-
ok(barView.barEvent, 'has barEvent handler');
|
|
36
|
-
|
|
37
|
-
evt = SC.Object.create(); // mock
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
teardown: function() {
|
|
41
|
-
pane = fooView = barView = defaultResponder = evt = null ;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("when invoked with target = nested view", function() {
|
|
46
|
-
var handler ;
|
|
47
|
-
|
|
48
|
-
// test event handler on target
|
|
49
|
-
callCount = 0;
|
|
50
|
-
handler = pane.sendTouchEvent('barEvent', evt, barView);
|
|
51
|
-
equals(callCount, 1, 'should invoke handler');
|
|
52
|
-
equals(handler[0], barView, 'should return view that handled event');
|
|
53
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
54
|
-
|
|
55
|
-
// test event handler on target parent
|
|
56
|
-
callCount = 0;
|
|
57
|
-
handler = pane.sendTouchEvent('fooEvent', evt, barView);
|
|
58
|
-
equals(callCount, 1, 'should invoke handler');
|
|
59
|
-
equals(handler[0], fooView, 'should return responder that handled event');
|
|
60
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
61
|
-
|
|
62
|
-
// test event handler on default responder
|
|
63
|
-
callCount = 0;
|
|
64
|
-
handler = pane.sendTouchEvent('defaultEvent', evt, barView);
|
|
65
|
-
equals(callCount, 1, 'should invoke handler');
|
|
66
|
-
equals(handler[0], defaultResponder, 'should return responder that handled event');
|
|
67
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
68
|
-
|
|
69
|
-
// test unhandled event handler
|
|
70
|
-
callCount = 0;
|
|
71
|
-
handler = pane.sendTouchEvent('imaginary', evt, barView);
|
|
72
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
73
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
74
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
test("when invoked with target = middle view", function() {
|
|
81
|
-
var handler ;
|
|
82
|
-
|
|
83
|
-
// test event handler on child view of target
|
|
84
|
-
callCount = 0;
|
|
85
|
-
handler = pane.sendTouchEvent('barEvent', evt, fooView);
|
|
86
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
87
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
88
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
89
|
-
|
|
90
|
-
// test event handler on target
|
|
91
|
-
callCount = 0;
|
|
92
|
-
handler = pane.sendTouchEvent('fooEvent', evt, fooView);
|
|
93
|
-
equals(callCount, 1, 'should invoke handler');
|
|
94
|
-
equals(handler[0], fooView, 'should return responder that handled event');
|
|
95
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// test event handler on default responder
|
|
99
|
-
callCount = 0;
|
|
100
|
-
handler = pane.sendTouchEvent('defaultEvent', evt, fooView);
|
|
101
|
-
equals(callCount, 1, 'should invoke handler');
|
|
102
|
-
equals(handler[0], defaultResponder, 'should return responder that handled event');
|
|
103
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// test unhandled event handler
|
|
107
|
-
callCount = 0;
|
|
108
|
-
handler = pane.sendTouchEvent('imaginary', evt, fooView);
|
|
109
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
110
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
111
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
test("when invoked with target = pane", function() {
|
|
118
|
-
var handler ;
|
|
119
|
-
|
|
120
|
-
// test event handler on child view of target
|
|
121
|
-
callCount = 0;
|
|
122
|
-
handler = pane.sendTouchEvent('barEvent', evt, pane);
|
|
123
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
124
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
125
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
126
|
-
|
|
127
|
-
// test event handler on target
|
|
128
|
-
callCount = 0;
|
|
129
|
-
handler = pane.sendTouchEvent('fooEvent', evt, pane);
|
|
130
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
131
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
132
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
133
|
-
|
|
134
|
-
// test event handler on default responder
|
|
135
|
-
callCount = 0;
|
|
136
|
-
handler = pane.sendTouchEvent('defaultEvent', evt, pane);
|
|
137
|
-
equals(callCount, 1, 'should invoke handler');
|
|
138
|
-
equals(handler[0], defaultResponder, 'should return responder that handled event');
|
|
139
|
-
equals(handler.get('length'), 1, 'should only be handled by one view');
|
|
140
|
-
|
|
141
|
-
// test unhandled event handler
|
|
142
|
-
callCount = 0;
|
|
143
|
-
handler = pane.sendTouchEvent('imaginary', evt, pane);
|
|
144
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
145
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
146
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
147
|
-
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
test("when invoked with target = null", function() {
|
|
153
|
-
var handler ;
|
|
154
|
-
|
|
155
|
-
// should start @ first responder
|
|
156
|
-
pane.firstResponder = fooView;
|
|
157
|
-
|
|
158
|
-
// test event handler on child view of target
|
|
159
|
-
callCount = 0;
|
|
160
|
-
handler = pane.sendTouchEvent('barEvent', evt);
|
|
161
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
162
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
163
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
164
|
-
|
|
165
|
-
// test event handler on target
|
|
166
|
-
callCount = 0;
|
|
167
|
-
handler = pane.sendTouchEvent('fooEvent', evt);
|
|
168
|
-
equals(callCount, 1, 'should invoke handler');
|
|
169
|
-
equals(handler[0], fooView, 'should return responder that handled event');
|
|
170
|
-
|
|
171
|
-
// test event handler on default responder
|
|
172
|
-
callCount = 0;
|
|
173
|
-
handler = pane.sendTouchEvent('defaultEvent', evt);
|
|
174
|
-
equals(callCount, 1, 'should invoke handler');
|
|
175
|
-
equals(handler[0], defaultResponder, 'should return responder that handled event');
|
|
176
|
-
|
|
177
|
-
// test unhandled event handler
|
|
178
|
-
callCount = 0;
|
|
179
|
-
handler = pane.sendTouchEvent('imaginary', evt);
|
|
180
|
-
equals(callCount, 0, 'should not invoke handler');
|
|
181
|
-
equals(SC.typeOf(handler), SC.T_ARRAY, 'should return array if no handlers');
|
|
182
|
-
equals(handler.get('length'), 0, 'array should be empty');
|
|
183
|
-
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
module("SC.Pane#sendTouchEvent - multiple views", {
|
|
187
|
-
setup: function() {
|
|
188
|
-
|
|
189
|
-
callCount = 0;
|
|
190
|
-
handlerYes = function(theEvent) {
|
|
191
|
-
callCount++ ;
|
|
192
|
-
equals(theEvent, evt, 'should pass event');
|
|
193
|
-
return YES;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
handlerNo = function(theEvent) {
|
|
197
|
-
callCount++ ;
|
|
198
|
-
equals(theEvent, evt, 'should pass event');
|
|
199
|
-
return NO;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
handlerMixed = function(theEvent) {
|
|
203
|
-
callCount++ ;
|
|
204
|
-
equals(theEvent, evt, 'should pass event');
|
|
205
|
-
return SC.MIXED_STATE;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
defaultResponder = SC.Object.create({ defaultEvent: handlerMixed,
|
|
209
|
-
barEvent: handlerMixed });
|
|
210
|
-
pane = SC.Pane.create({
|
|
211
|
-
defaultResponder: defaultResponder,
|
|
212
|
-
childViews: [SC.View.extend({
|
|
213
|
-
fooEvent: handlerMixed,
|
|
214
|
-
barEvent: handlerMixed,
|
|
215
|
-
childViews: [SC.View.extend({
|
|
216
|
-
barEvent: handlerMixed
|
|
217
|
-
})]
|
|
218
|
-
})]
|
|
219
|
-
});
|
|
220
|
-
fooView = pane.childViews[0];
|
|
221
|
-
ok(fooView.fooEvent, 'has fooEvent handler');
|
|
222
|
-
|
|
223
|
-
barView = fooView.childViews[0];
|
|
224
|
-
ok(barView.barEvent, 'has barEvent handler');
|
|
225
|
-
|
|
226
|
-
evt = SC.Object.create(); // mock
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
teardown: function() {
|
|
230
|
-
pane = fooView = barView = defaultResponder = evt = null ;
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test('view chain with only non-exclusive responders', function() {
|
|
235
|
-
var handler;
|
|
236
|
-
|
|
237
|
-
callCount = 0;
|
|
238
|
-
handler = pane.sendTouchEvent('barEvent', evt, barView);
|
|
239
|
-
equals(callCount, 3, 'should invoke handler on entire chain');
|
|
240
|
-
equals(handler[0], barView, 'should return responder that returned SC.MIXED_STATE');
|
|
241
|
-
equals(handler[1], fooView, 'should return responder that returned SC.MIXED_STATE');
|
|
242
|
-
equals(handler[2], defaultResponder, 'should return responder that returned SC.MIXED_STATE');
|
|
243
|
-
equals(handler.get('length'), 3, 'should be handled by all three responders');
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
test('view chain with one exclusive responder', function() {
|
|
247
|
-
var handler;
|
|
248
|
-
|
|
249
|
-
fooView.barEvent = handlerYes;
|
|
250
|
-
callCount = 0;
|
|
251
|
-
handler = pane.sendTouchEvent('barEvent', evt, barView);
|
|
252
|
-
equals(callCount, 2, 'should invoke handler on first two views');
|
|
253
|
-
equals(handler[0], fooView, 'should return responder that returned YES');
|
|
254
|
-
equals(handler.get('length'), 1, 'responder should have exclusive control');
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
test('view chain with default responder that returns YES', function() {
|
|
258
|
-
var handler;
|
|
259
|
-
|
|
260
|
-
fooView.barEvent = handlerNo;
|
|
261
|
-
defaultResponder.barEvent = handlerYes;
|
|
262
|
-
callCount = 0;
|
|
263
|
-
handler = pane.sendTouchEvent('barEvent', evt, barView);
|
|
264
|
-
equals(callCount, 3, 'should invoke handler on all three responders');
|
|
265
|
-
equals(handler[0], defaultResponder, 'should return responder that returned YES');
|
|
266
|
-
equals(handler.get('length'), 1, 'responder should have exclusive control');
|
|
267
|
-
});
|