sproutcore 1.6.0.beta.3-x86-mingw32 → 1.6.0.rc.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +33 -0
- data/Rakefile +213 -10
- data/VERSION.yml +1 -1
- data/lib/Buildfile +5 -1
- data/lib/buildtasks/manifest.rake +7 -1
- data/lib/frameworks/sproutcore/Buildfile +3 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +154 -1
- data/lib/frameworks/sproutcore/README.md +1 -1
- data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +254 -207
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +243 -172
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +20 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +61 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +20 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +396 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +78 -51
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +233 -67
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +66 -55
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +190 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +23 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +121 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +114 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +35 -33
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +55 -13
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +130 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +4 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +7 -189
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +14 -78
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +11 -2
- data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
- data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +24 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +7 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
- data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
- data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
- data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
- data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
- data/lib/gen/design/templates/resources/@filename@.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
- data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/html_project/templates/@filename@/README +1 -4
- data/lib/gen/language/templates/@filename@/strings.js +1 -4
- data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
- data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
- data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
- data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
- data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
- data/lib/gen/project/templates/@filename@/Buildfile +1 -4
- data/lib/gen/project/templates/@filename@/README +1 -5
- data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
- data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
- data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
- data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
- data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
- data/lib/sproutcore.rb +4 -1
- data/lib/sproutcore/builders/handlebars.rb +1 -1
- data/lib/sproutcore/builders/module.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +4 -2
- data/lib/sproutcore/models/generator.rb +22 -0
- data/lib/sproutcore/models/manifest_entry.rb +1 -0
- data/lib/sproutcore/models/target.rb +4 -1
- data/lib/sproutcore/rack/builder.rb +3 -0
- data/lib/sproutcore/tools.rb +11 -11
- data/lib/sproutcore/tools/init.rb +10 -22
- data/lib/sproutcore/tools/manifest.rb +21 -22
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
- data/spec/fixtures/ordered_entries/apps/template_style/a.js +0 -0
- data/spec/fixtures/ordered_entries/apps/template_style/template_style.js +0 -0
- data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
- data/spec/lib/tools/manifest_spec.rb +11 -0
- data/sproutcore.gemspec +2 -2
- data/vendor/chance/lib/chance/instance.rb +3 -1
- metadata +150 -106
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
- data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
- data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
@@ -14,8 +14,8 @@ sc_require('models/record');
|
|
14
14
|
SC.ChildRecord = SC.Record.extend({});
|
15
15
|
|
16
16
|
SC.ChildRecord.extend = function() {
|
17
|
-
|
17
|
+
// @if (debug)
|
18
18
|
console.log("SC.ChildRecord is deprecated. Please extend SC.Record instead.");
|
19
|
-
|
19
|
+
// @endif
|
20
20
|
return SC.Record.extend.apply(this, arguments);
|
21
21
|
};
|
@@ -572,6 +572,7 @@ if (SC.DateTime && !SC.RecordAttribute.transforms[SC.guidFor(SC.DateTime)]) {
|
|
572
572
|
*/
|
573
573
|
to: function(str, attr) {
|
574
574
|
if (SC.none(str) || SC.instanceOf(str, SC.DateTime)) return str;
|
575
|
+
if (SC.none(str) || SC.instanceOf(str, Date)) return SC.DateTime.create(str.getTime());
|
575
576
|
var format = attr.get('format');
|
576
577
|
return SC.DateTime.parse(str, format ? format : SC.DateTime.recordFormat);
|
577
578
|
},
|
@@ -104,7 +104,6 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
104
104
|
ret = hash[pname] = [];
|
105
105
|
}
|
106
106
|
|
107
|
-
if (ret !== this._prevChildren) this.recordPropertyDidChange();
|
108
107
|
return ret ;
|
109
108
|
}.property(),
|
110
109
|
|
@@ -169,9 +168,11 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
169
168
|
|
170
169
|
pname = this.get('propertyName'),
|
171
170
|
cr, recordType;
|
171
|
+
|
172
172
|
newRecs = this._processRecordsToHashes(recs);
|
173
173
|
children.replace(idx, amt, newRecs);
|
174
174
|
// notify that the record did change...
|
175
|
+
if (newRecs !== this._prevChildren) this.recordPropertyDidChange();
|
175
176
|
record.recordDidChange(pname);
|
176
177
|
|
177
178
|
return this;
|
@@ -245,7 +246,7 @@ SC.ChildArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
245
246
|
newLen = children.get('length');
|
246
247
|
}
|
247
248
|
|
248
|
-
|
249
|
+
|
249
250
|
this.arrayContentWillChange(0, oldLen, newLen);
|
250
251
|
this._prevChildren = children;
|
251
252
|
this._childrenContentDidChange(0, oldLen, newLen);
|
@@ -14,33 +14,33 @@ sc_require('models/record');
|
|
14
14
|
object. When you access the items of a `RecordArray`, it will automatically
|
15
15
|
convert the `storeKeys` into actual `SC.Record` objects that the rest of
|
16
16
|
your application can work with.
|
17
|
-
|
17
|
+
|
18
18
|
Normally you do not create `RecordArray`s yourself. Instead, a
|
19
19
|
`RecordArray` is returned when you call `SC.Store.findAll()`, already
|
20
20
|
properly configured. You can usually just work with the `RecordArray`
|
21
21
|
instance just like any other array.
|
22
|
-
|
22
|
+
|
23
23
|
The information below about `RecordArray` internals is only intended for
|
24
24
|
those who need to override this class for some reason to do something
|
25
25
|
special.
|
26
|
-
|
26
|
+
|
27
27
|
Internal Notes
|
28
28
|
---
|
29
|
-
|
29
|
+
|
30
30
|
Normally the `RecordArray` behavior is very simple. Any array-like
|
31
31
|
operations will be translated into similar calls onto the underlying array
|
32
|
-
of `storeKeys`. The underlying array can be a real array or it may be a
|
32
|
+
of `storeKeys`. The underlying array can be a real array or it may be a
|
33
33
|
`SparseArray`, which is how you implement incremental loading.
|
34
|
-
|
35
|
-
If the `RecordArray` is created with an `SC.Query` object as well (and it
|
36
|
-
almost always will have a `Query` object), then the `RecordArray` will also
|
37
|
-
consult the query for various delegate operations such as determining if
|
34
|
+
|
35
|
+
If the `RecordArray` is created with an `SC.Query` object as well (and it
|
36
|
+
almost always will have a `Query` object), then the `RecordArray` will also
|
37
|
+
consult the query for various delegate operations such as determining if
|
38
38
|
the record array should update automatically whenever records in the store
|
39
39
|
changes. It will also ask the `Query` to refresh the `storeKeys` whenever
|
40
40
|
records change in the store.
|
41
|
-
|
42
|
-
If the `SC.Query` object has complex matching rules, it might be
|
43
|
-
computationally heavy to match a large dataset to a query. To avoid the
|
41
|
+
|
42
|
+
If the `SC.Query` object has complex matching rules, it might be
|
43
|
+
computationally heavy to match a large dataset to a query. To avoid the
|
44
44
|
browser from ever showing a slow script timer in this scenario, the query
|
45
45
|
matching is by default paced at 100ms. If query matching takes longer than
|
46
46
|
100ms, it will chunk the work with setTimeout to avoid too much computation
|
@@ -57,12 +57,12 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
57
57
|
/** @scope SC.RecordArray.prototype */ {
|
58
58
|
|
59
59
|
/**
|
60
|
-
The store that owns this record array. All record arrays must have a
|
61
|
-
store to function properly.
|
62
|
-
|
60
|
+
The store that owns this record array. All record arrays must have a
|
61
|
+
store to function properly.
|
62
|
+
|
63
63
|
NOTE: You **MUST** set this property on the `RecordArray` when creating
|
64
64
|
it or else it will fail.
|
65
|
-
|
65
|
+
|
66
66
|
@type SC.Store
|
67
67
|
*/
|
68
68
|
store: null,
|
@@ -74,14 +74,14 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
74
74
|
|
75
75
|
NOTE: You **MUST** set this property on the `RecordArray` when creating
|
76
76
|
it or else it will fail.
|
77
|
-
|
77
|
+
|
78
78
|
@type SC.Query
|
79
79
|
*/
|
80
80
|
query: null,
|
81
81
|
|
82
82
|
/**
|
83
83
|
The array of `storeKeys` as retrieved from the owner store.
|
84
|
-
|
84
|
+
|
85
85
|
@type SC.Array
|
86
86
|
*/
|
87
87
|
storeKeys: null,
|
@@ -95,14 +95,15 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
95
95
|
status: SC.Record.EMPTY,
|
96
96
|
|
97
97
|
/**
|
98
|
-
The current
|
98
|
+
The current editable state based on the query. If this record array is not
|
99
|
+
backed by an SC.Query, it is assumed to be editable.
|
99
100
|
|
100
101
|
@property
|
101
102
|
@type Boolean
|
102
103
|
*/
|
103
104
|
isEditable: function() {
|
104
105
|
var query = this.get('query');
|
105
|
-
return query ? query.get('isEditable') :
|
106
|
+
return query ? query.get('isEditable') : YES;
|
106
107
|
}.property('query').cacheable(),
|
107
108
|
|
108
109
|
// ..........................................................
|
@@ -119,6 +120,14 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
119
120
|
return storeKeys ? storeKeys.get('length') : 0;
|
120
121
|
}.property('storeKeys').cacheable(),
|
121
122
|
|
123
|
+
/** @private
|
124
|
+
A cache of materialized records. The first time an instance of SC.Record is
|
125
|
+
created for a store key at a given index, it will be saved to this array.
|
126
|
+
|
127
|
+
Whenever the `storeKeys` property is reset, this cache is also reset.
|
128
|
+
|
129
|
+
@type Array
|
130
|
+
*/
|
122
131
|
_scra_records: null,
|
123
132
|
|
124
133
|
/** @private
|
@@ -181,13 +190,19 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
181
190
|
},
|
182
191
|
|
183
192
|
/** @private
|
184
|
-
|
185
|
-
records
|
186
|
-
|
193
|
+
Replaces a range of records starting at a given index with the replacement
|
194
|
+
records provided. The objects to be inserted must be instances of SC.Record
|
195
|
+
and must have a store key assigned to them.
|
196
|
+
|
197
|
+
Note that most SC.RecordArrays are *not* editable via `replace()`, since they
|
198
|
+
are generated by a rule-based SC.Query. You can check the `isEditable` property
|
199
|
+
before attempting to modify a record array.
|
200
|
+
|
187
201
|
@param {Number} idx start index
|
188
|
-
@param {Number} amt
|
189
|
-
@param {SC.RecordArray} recs
|
190
|
-
|
202
|
+
@param {Number} amt count of records to remove
|
203
|
+
@param {SC.RecordArray} recs the records that should replace the removed records
|
204
|
+
|
205
|
+
@returns {SC.RecordArray} receiver, after mutation has occurred
|
191
206
|
*/
|
192
207
|
replace: function(idx, amt, recs) {
|
193
208
|
|
@@ -197,13 +212,9 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
197
212
|
len = recs ? (recs.get ? recs.get('length') : recs.length) : 0,
|
198
213
|
i, keys;
|
199
214
|
|
200
|
-
if (!storeKeys) throw "storeKeys
|
215
|
+
if (!storeKeys) throw "Unable to edit an SC.RecordArray that does not have its storeKeys property set.";
|
201
216
|
|
202
|
-
|
203
|
-
if (query && !query.get('isEditable')) throw SC.RecordArray.NOT_EDITABLE;
|
204
|
-
|
205
|
-
// you can't modify an array whose store keys are autogenerated from a
|
206
|
-
// query.
|
217
|
+
if (!this.get('isEditable')) throw SC.RecordArray.NOT_EDITABLE;
|
207
218
|
|
208
219
|
// map to store keys
|
209
220
|
keys = [] ;
|
@@ -266,10 +277,10 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
266
277
|
return storeKeys ? storeKeys.lastIndexOf(storeKey, startAt) : -1;
|
267
278
|
},
|
268
279
|
|
269
|
-
/**
|
270
|
-
Adds the specified record to the record array if it is not already part
|
280
|
+
/**
|
281
|
+
Adds the specified record to the record array if it is not already part
|
271
282
|
of the array. Provided for compatibilty with `SC.Set`.
|
272
|
-
|
283
|
+
|
273
284
|
@param {SC.Record} record
|
274
285
|
@returns {SC.RecordArray} receiver
|
275
286
|
*/
|
@@ -282,7 +293,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
282
293
|
/**
|
283
294
|
Removes the specified record from the array if it is not already a part
|
284
295
|
of the array. Provided for compatibility with `SC.Set`.
|
285
|
-
|
296
|
+
|
286
297
|
@param {SC.Record} record
|
287
298
|
@returns {SC.RecordArray} receiver
|
288
299
|
*/
|
@@ -324,11 +335,11 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
324
335
|
|
325
336
|
/**
|
326
337
|
Will recompute the results based on the `SC.Query` attached to the record
|
327
|
-
array. Useful if your query is based on computed properties that might
|
338
|
+
array. Useful if your query is based on computed properties that might
|
328
339
|
have changed. Use `refresh()` instead of you want to trigger a fetch on
|
329
340
|
your data source since this will purely look at records already loaded
|
330
341
|
into the store.
|
331
|
-
|
342
|
+
|
332
343
|
@returns {SC.RecordArray} receiver
|
333
344
|
*/
|
334
345
|
reload: function() {
|
@@ -352,14 +363,14 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
352
363
|
|
353
364
|
// ..........................................................
|
354
365
|
// STORE CALLBACKS
|
355
|
-
//
|
356
|
-
|
366
|
+
//
|
367
|
+
|
357
368
|
// **NOTE**: `storeWillFetchQuery()`, `storeDidFetchQuery()`,
|
358
369
|
// `storeDidCancelQuery()`, and `storeDidErrorQuery()` are tested implicitly
|
359
370
|
// through the related methods in `SC.Store`. We're doing it this way
|
360
371
|
// because eventually this particular implementation is likely to change;
|
361
372
|
// moving some or all of this code directly into the store. -CAJ
|
362
|
-
|
373
|
+
|
363
374
|
/** @private
|
364
375
|
Called whenever the store initiates a refresh of the query. Sets the
|
365
376
|
status of the record array to the appropriate status.
|
@@ -416,10 +427,13 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
416
427
|
},
|
417
428
|
|
418
429
|
/** @private
|
419
|
-
Called by the store whenever it changes the state of certain store keys.
|
420
|
-
|
421
|
-
|
422
|
-
|
430
|
+
Called by the store whenever it changes the state of certain store keys. If
|
431
|
+
the receiver cares about these changes, it will mark itself as dirty and add
|
432
|
+
the changed store keys to the _scq_changedStoreKeys index set.
|
433
|
+
|
434
|
+
The next time you try to access the record array, it will call `flush()` and
|
435
|
+
add the changed keys to the underlying `storeKeys` array if the new records
|
436
|
+
match the conditions of the record array's query.
|
423
437
|
|
424
438
|
@param {SC.Array} storeKeys the effected store keys
|
425
439
|
@param {SC.Set} recordTypes the record types for the storeKeys.
|
@@ -437,11 +451,8 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
437
451
|
changed.addEach(storeKeys);
|
438
452
|
|
439
453
|
this.set('needsFlush', YES);
|
440
|
-
|
441
454
|
if (this.get('storeKeys')) {
|
442
455
|
this.flush();
|
443
|
-
} else {
|
444
|
-
this.arrayContentDidChange();
|
445
456
|
}
|
446
457
|
|
447
458
|
return this;
|
@@ -453,8 +464,8 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
453
464
|
you access the RecordArray to make sure it is up to date, but you can
|
454
465
|
call it yourself as well if you need to force the record array to fully
|
455
466
|
update immediately.
|
456
|
-
|
457
|
-
Currently this method only has an effect if the query location is
|
467
|
+
|
468
|
+
Currently this method only has an effect if the query location is
|
458
469
|
`SC.Query.LOCAL`. You can call this method on any `RecordArray` however,
|
459
470
|
without an error.
|
460
471
|
|
@@ -604,7 +615,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
604
615
|
},
|
605
616
|
|
606
617
|
/**
|
607
|
-
Set to `YES` when the query is dirty and needs to update its storeKeys
|
618
|
+
Set to `YES` when the query is dirty and needs to update its storeKeys
|
608
619
|
before returning any results. `RecordArray`s always start dirty and become
|
609
620
|
clean the first time you try to access their contents.
|
610
621
|
|
@@ -619,7 +630,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
619
630
|
/**
|
620
631
|
Returns `YES` whenever the status is `SC.Record.ERROR`. This will allow
|
621
632
|
you to put the UI into an error state.
|
622
|
-
|
633
|
+
|
623
634
|
@property
|
624
635
|
@type Boolean
|
625
636
|
*/
|
@@ -630,7 +641,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
630
641
|
/**
|
631
642
|
Returns the receiver if the record array is in an error state. Returns
|
632
643
|
`null` otherwise.
|
633
|
-
|
644
|
+
|
634
645
|
@property
|
635
646
|
@type SC.Record
|
636
647
|
*/
|
@@ -642,7 +653,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
642
653
|
Returns the current error object only if the record array is in an error
|
643
654
|
state. If no explicit error object has been set, returns
|
644
655
|
`SC.Record.GENERIC_ERROR.`
|
645
|
-
|
656
|
+
|
646
657
|
@property
|
647
658
|
@type SC.Error
|
648
659
|
*/
|
@@ -655,7 +666,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
|
|
655
666
|
|
656
667
|
// ..........................................................
|
657
668
|
// INTERNAL SUPPORT
|
658
|
-
//
|
669
|
+
//
|
659
670
|
|
660
671
|
propertyWillChange: function(key) {
|
661
672
|
if (key === 'storeKeys') {
|
@@ -0,0 +1,190 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SC.DataSource Unit Test
|
3
|
+
// Copyright: ©2011 Junction Networks and contributors.
|
4
|
+
// License: Licensed under MIT license (see license.js)
|
5
|
+
// ==========================================================================
|
6
|
+
/*globals JN module test ok equals same stop start */
|
7
|
+
|
8
|
+
var MyApp, wasCalled;
|
9
|
+
module("SC.DataSource", {
|
10
|
+
setup: function () {
|
11
|
+
MyApp = window.MyApp = {};
|
12
|
+
MyApp.store = SC.Store.create();
|
13
|
+
MyApp.Foo = SC.Record.extend();
|
14
|
+
|
15
|
+
MyApp.DataSource = SC.DataSource.extend({
|
16
|
+
fetch: function (store, query) {
|
17
|
+
wasCalled = true;
|
18
|
+
equals(arguments.length, 2);
|
19
|
+
return YES;
|
20
|
+
},
|
21
|
+
|
22
|
+
createRecord: function (store, storeKey, params) {
|
23
|
+
wasCalled = true;
|
24
|
+
equals(arguments.length, 3);
|
25
|
+
return YES;
|
26
|
+
},
|
27
|
+
|
28
|
+
updateRecord: function (store, storeKey, params) {
|
29
|
+
wasCalled = true;
|
30
|
+
equals(arguments.length, 3);
|
31
|
+
return YES;
|
32
|
+
},
|
33
|
+
|
34
|
+
retrieveRecord: function (store, storeKey, params) {
|
35
|
+
wasCalled = true;
|
36
|
+
equals(arguments.length, 3);
|
37
|
+
return YES;
|
38
|
+
},
|
39
|
+
|
40
|
+
destroyRecord: function (store, storeKey, params) {
|
41
|
+
wasCalled = true;
|
42
|
+
equals(arguments.length, 3);
|
43
|
+
return YES;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
SC.RunLoop.begin();
|
47
|
+
},
|
48
|
+
|
49
|
+
teardown: function () {
|
50
|
+
SC.RunLoop.end();
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
test("The dataSource will forward calls to the appropriate methods", function () {
|
55
|
+
var ds = MyApp.DataSource.create();
|
56
|
+
MyApp.store.set('dataSource', ds);
|
57
|
+
ok(MyApp.store.find(SC.Query.remote(MyApp.Foo)),
|
58
|
+
"the fetch should return a record array");
|
59
|
+
ok(wasCalled, "`fetch` should have been called");
|
60
|
+
wasCalled = NO;
|
61
|
+
|
62
|
+
ok(MyApp.store.find(MyApp.Foo, "testing retrieve"),
|
63
|
+
"retrieve should return a new record (because the dataSource handled the request YES)");
|
64
|
+
ok(wasCalled, "`retrieve` should have been called");
|
65
|
+
wasCalled = NO;
|
66
|
+
|
67
|
+
var rec = MyApp.store.createRecord(MyApp.Foo, {});
|
68
|
+
|
69
|
+
equals(MyApp.store.commitRecord(MyApp.Foo, 'foo', rec.get('storeKey')), YES,
|
70
|
+
"commiting a new record should return YES");
|
71
|
+
ok(wasCalled, "`createRecord` should have been called");
|
72
|
+
wasCalled = NO;
|
73
|
+
|
74
|
+
MyApp.store.writeStatus(rec.get('storeKey'), SC.Record.READY_CLEAN);
|
75
|
+
|
76
|
+
rec.set('zero', 0);
|
77
|
+
equals(MyApp.store.commitRecord(MyApp.Foo, 'foo', rec.get('storeKey')), YES,
|
78
|
+
"updating a record should return YES");
|
79
|
+
ok(wasCalled, "`updateRecord` should have been called");
|
80
|
+
wasCalled = NO;
|
81
|
+
|
82
|
+
MyApp.store.writeStatus(rec.get('storeKey'), SC.Record.READY_CLEAN);
|
83
|
+
|
84
|
+
rec.destroy();
|
85
|
+
// broken in SC.Store
|
86
|
+
equals(MyApp.store.commitRecord(MyApp.Foo, 'foo', rec.get('storeKey')), YES,
|
87
|
+
"destroying the record should return YES");
|
88
|
+
ok(wasCalled, "`destroyRecord` should have been called");
|
89
|
+
});
|
90
|
+
|
91
|
+
test("The dataSource will return YES when all records committed return YES", function () {
|
92
|
+
var ds = MyApp.DataSource.create({
|
93
|
+
createRecord: function () { return YES; },
|
94
|
+
updateRecord: function () { return YES; },
|
95
|
+
destroyRecord: function () { return YES; }
|
96
|
+
});
|
97
|
+
|
98
|
+
MyApp.store.set('dataSource', ds);
|
99
|
+
|
100
|
+
var rec1 = MyApp.store.createRecord(MyApp.Foo, {}),
|
101
|
+
rec2, rec3;
|
102
|
+
|
103
|
+
equals(MyApp.store.commitRecords(), YES,
|
104
|
+
"commiting a single new record should return YES");
|
105
|
+
|
106
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
107
|
+
|
108
|
+
rec1.set('zero', 0);
|
109
|
+
rec2 = MyApp.store.createRecord(MyApp.Foo, {});
|
110
|
+
|
111
|
+
equals(MyApp.store.commitRecords(), YES,
|
112
|
+
"commiting records for an 'update' and 'create' should return YES");
|
113
|
+
|
114
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
115
|
+
MyApp.store.writeStatus(rec2.get('storeKey'), SC.Record.READY_CLEAN);
|
116
|
+
|
117
|
+
rec1.destroy();
|
118
|
+
rec2.set('one', 1);
|
119
|
+
rec3 = MyApp.store.createRecord(MyApp.Foo, {});
|
120
|
+
|
121
|
+
equals(MyApp.store.commitRecords(), YES,
|
122
|
+
"commiting records for an 'update', 'create', and 'destroy' should return YES");
|
123
|
+
});
|
124
|
+
|
125
|
+
test("The dataSource will return SC.MIXED_STATE when all records committed return YES and NO", function () {
|
126
|
+
var ds = MyApp.DataSource.create({
|
127
|
+
createRecord: function () { return NO; },
|
128
|
+
updateRecord: function () { return YES; },
|
129
|
+
destroyRecord: function () { return NO; }
|
130
|
+
});
|
131
|
+
|
132
|
+
MyApp.store.set('dataSource', ds);
|
133
|
+
|
134
|
+
var rec1 = MyApp.store.createRecord(MyApp.Foo, {}),
|
135
|
+
rec2, rec3;
|
136
|
+
|
137
|
+
equals(MyApp.store.commitRecords(), NO,
|
138
|
+
"commiting a single new record should return NO");
|
139
|
+
|
140
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
141
|
+
|
142
|
+
rec1.set('zero', 0);
|
143
|
+
rec2 = MyApp.store.createRecord(MyApp.Foo, {});
|
144
|
+
|
145
|
+
equals(MyApp.store.commitRecords(), SC.MIXED_STATE,
|
146
|
+
"commiting records for an 'update' and 'create' should return %@".fmt(SC.MIXED_STATE));
|
147
|
+
|
148
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
149
|
+
MyApp.store.writeStatus(rec2.get('storeKey'), SC.Record.READY_CLEAN);
|
150
|
+
|
151
|
+
rec1.destroy();
|
152
|
+
rec2.set('one', 1);
|
153
|
+
rec3 = MyApp.store.createRecord(MyApp.Foo, {});
|
154
|
+
|
155
|
+
equals(MyApp.store.commitRecords(), SC.MIXED_STATE,
|
156
|
+
"commiting records for an 'update', 'create', and 'destroy' should return %@".fmt(SC.MIXED_STATE));
|
157
|
+
});
|
158
|
+
|
159
|
+
test("The dataSource will return NO when all records committed return NO", function () {
|
160
|
+
var ds = MyApp.DataSource.create({
|
161
|
+
createRecord: function () { return NO; },
|
162
|
+
updateRecord: function () { return NO; },
|
163
|
+
destroyRecord: function () { return NO; }
|
164
|
+
});
|
165
|
+
MyApp.store.set('dataSource', ds);
|
166
|
+
|
167
|
+
var rec1 = MyApp.store.createRecord(MyApp.Foo, {}),
|
168
|
+
rec2, rec3;
|
169
|
+
|
170
|
+
equals(MyApp.store.commitRecords(), NO,
|
171
|
+
"commiting a single new record should return NO");
|
172
|
+
|
173
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
174
|
+
|
175
|
+
rec1.set('zero', 0);
|
176
|
+
rec2 = MyApp.store.createRecord(MyApp.Foo, {});
|
177
|
+
|
178
|
+
equals(MyApp.store.commitRecords(), NO,
|
179
|
+
"commiting records for an 'update' and 'create' should return NO");
|
180
|
+
|
181
|
+
MyApp.store.writeStatus(rec1.get('storeKey'), SC.Record.READY_CLEAN);
|
182
|
+
MyApp.store.writeStatus(rec2.get('storeKey'), SC.Record.READY_CLEAN);
|
183
|
+
|
184
|
+
rec1.destroy();
|
185
|
+
rec2.set('one', 1);
|
186
|
+
rec3 = MyApp.store.createRecord(MyApp.Foo, {});
|
187
|
+
|
188
|
+
equals(MyApp.store.commitRecords(), NO,
|
189
|
+
"commiting records for an 'update', 'create', and 'destroy' should return NO");
|
190
|
+
});
|