sproutcore 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +269 -0
- data/README.txt +67 -0
- data/Rakefile +4 -0
- data/app_generators/sproutcore/USAGE +5 -0
- data/app_generators/sproutcore/sproutcore_generator.rb +66 -0
- data/app_generators/sproutcore/templates/README +77 -0
- data/app_generators/sproutcore/templates/environment.yml +4 -0
- data/bin/sc-build +145 -0
- data/bin/sc-gen +24 -0
- data/bin/sc-server +63 -0
- data/bin/sproutcore +21 -0
- data/clients/sc_docs/controllers/docs.js +118 -0
- data/clients/sc_docs/core.js +19 -0
- data/clients/sc_docs/english.lproj/body.css +159 -0
- data/clients/sc_docs/english.lproj/body.rhtml +33 -0
- data/clients/sc_docs/english.lproj/controls.css +0 -0
- data/clients/sc_docs/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_docs/english.lproj/icons/small/reset.png +0 -0
- data/clients/sc_docs/english.lproj/images/gradients.png +0 -0
- data/clients/sc_docs/english.lproj/images/indicator.gif +0 -0
- data/clients/sc_docs/english.lproj/images/toolbar.png +0 -0
- data/clients/sc_docs/english.lproj/no_docs.rhtml +7 -0
- data/clients/sc_docs/english.lproj/strings.js +14 -0
- data/clients/sc_docs/english.lproj/warning.rhtml +6 -0
- data/clients/sc_docs/fixtures/doc.js +11 -0
- data/clients/sc_docs/main.js +21 -0
- data/clients/sc_docs/models/doc.js +9 -0
- data/clients/sc_docs/tests/controllers/docs.rhtml +21 -0
- data/clients/sc_docs/tests/models/doc.rhtml +21 -0
- data/clients/sc_docs/tests/views/doc_frame.rhtml +21 -0
- data/clients/sc_docs/tests/views/doc_label_view.rhtml +21 -0
- data/clients/sc_docs/views/doc_frame.js +33 -0
- data/clients/sc_docs/views/doc_label.js +20 -0
- data/clients/sc_test_runner/controllers/runner.js +175 -0
- data/clients/sc_test_runner/core.js +19 -0
- data/clients/sc_test_runner/english.lproj/body.css +151 -0
- data/clients/sc_test_runner/english.lproj/body.rhtml +35 -0
- data/clients/sc_test_runner/english.lproj/controls.css +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/gradients.png +0 -0
- data/clients/sc_test_runner/english.lproj/images/indicator.gif +0 -0
- data/clients/sc_test_runner/english.lproj/images/toolbar.png +0 -0
- data/clients/sc_test_runner/english.lproj/no_tests.rhtml +6 -0
- data/clients/sc_test_runner/english.lproj/strings.js +14 -0
- data/clients/sc_test_runner/english.lproj/warning.rhtml +6 -0
- data/clients/sc_test_runner/fixtures/test.js +12 -0
- data/clients/sc_test_runner/main.js +26 -0
- data/clients/sc_test_runner/models/test.js +11 -0
- data/clients/sc_test_runner/views/runner_frame.js +72 -0
- data/clients/sc_test_runner/views/test_label.js +20 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/environment.yml +9 -0
- data/frameworks/prototype/prototype.js +4186 -0
- data/frameworks/sproutcore/Core.js +378 -0
- data/frameworks/sproutcore/README +3 -0
- data/frameworks/sproutcore/controllers/array.js +236 -0
- data/frameworks/sproutcore/controllers/collection.js +305 -0
- data/frameworks/sproutcore/controllers/controller.js +323 -0
- data/frameworks/sproutcore/controllers/object.js +372 -0
- data/frameworks/sproutcore/drag/drag.js +549 -0
- data/frameworks/sproutcore/drag/drag_data_source.js +32 -0
- data/frameworks/sproutcore/drag/drag_source.js +64 -0
- data/frameworks/sproutcore/drag/drop_target.js +153 -0
- data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
- data/frameworks/sproutcore/english.lproj/buttons.css +589 -0
- data/frameworks/sproutcore/english.lproj/buttons.png +0 -0
- data/frameworks/sproutcore/english.lproj/inline_text_editor.css +21 -0
- data/frameworks/sproutcore/english.lproj/menu.css +121 -0
- data/frameworks/sproutcore/english.lproj/panels/background-fat.jpg +0 -0
- data/frameworks/sproutcore/english.lproj/panels/background-thin.jpg +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-left-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/bottom-right-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/left-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/overlay.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/right-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-edge.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-left-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panels/top-right-corner.png +0 -0
- data/frameworks/sproutcore/english.lproj/panes.css +155 -0
- data/frameworks/sproutcore/english.lproj/picker.css +22 -0
- data/frameworks/sproutcore/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/english.lproj/tab.css +23 -0
- data/frameworks/sproutcore/english.lproj/tests.css +67 -0
- data/frameworks/sproutcore/english.lproj/theme.css +77 -0
- data/frameworks/sproutcore/foundation/animator.js +670 -0
- data/frameworks/sproutcore/foundation/application.js +199 -0
- data/frameworks/sproutcore/foundation/array.js +348 -0
- data/frameworks/sproutcore/foundation/benchmark.js +211 -0
- data/frameworks/sproutcore/foundation/binding.js +384 -0
- data/frameworks/sproutcore/foundation/date.js +357 -0
- data/frameworks/sproutcore/foundation/error.js +39 -0
- data/frameworks/sproutcore/foundation/input_manager.js +153 -0
- data/frameworks/sproutcore/foundation/json.js +296 -0
- data/frameworks/sproutcore/foundation/mock.js +42 -0
- data/frameworks/sproutcore/foundation/node_descriptor.js +56 -0
- data/frameworks/sproutcore/foundation/object.js +777 -0
- data/frameworks/sproutcore/foundation/observable.js +451 -0
- data/frameworks/sproutcore/foundation/page.js +63 -0
- data/frameworks/sproutcore/foundation/path_module.js +413 -0
- data/frameworks/sproutcore/foundation/responder.js +310 -0
- data/frameworks/sproutcore/foundation/routes.js +371 -0
- data/frameworks/sproutcore/foundation/run_loop.js +21 -0
- data/frameworks/sproutcore/foundation/server.js +491 -0
- data/frameworks/sproutcore/foundation/set.js +96 -0
- data/frameworks/sproutcore/foundation/string.js +149 -0
- data/frameworks/sproutcore/foundation/undo_manager.js +186 -0
- data/frameworks/sproutcore/foundation/unittest.js +622 -0
- data/frameworks/sproutcore/foundation/utils.js +61 -0
- data/frameworks/sproutcore/globals/panels.js +182 -0
- data/frameworks/sproutcore/globals/popups.js +60 -0
- data/frameworks/sproutcore/globals/window.js +381 -0
- data/frameworks/sproutcore/lib/index.rhtml +66 -0
- data/frameworks/sproutcore/models/collection.js +395 -0
- data/frameworks/sproutcore/models/record.js +622 -0
- data/frameworks/sproutcore/models/store.js +295 -0
- data/frameworks/sproutcore/panes/dialog.js +16 -0
- data/frameworks/sproutcore/panes/manager.js +164 -0
- data/frameworks/sproutcore/panes/menu.js +45 -0
- data/frameworks/sproutcore/panes/overlay.js +231 -0
- data/frameworks/sproutcore/panes/pane.js +90 -0
- data/frameworks/sproutcore/panes/panel.js +19 -0
- data/frameworks/sproutcore/panes/picker.js +45 -0
- data/frameworks/sproutcore/tests/controllers/array.rhtml +86 -0
- data/frameworks/sproutcore/tests/controllers/controller.rhtml +273 -0
- data/frameworks/sproutcore/tests/controllers/object.rhtml +327 -0
- data/frameworks/sproutcore/tests/foundation/application.rhtml +125 -0
- data/frameworks/sproutcore/tests/foundation/array.rhtml +221 -0
- data/frameworks/sproutcore/tests/foundation/object.rhtml +69 -0
- data/frameworks/sproutcore/tests/globals/window.rhtml +45 -0
- data/frameworks/sproutcore/tests/panes/pane.rhtml +88 -0
- data/frameworks/sproutcore/tests/views/collection.rhtml +137 -0
- data/frameworks/sproutcore/tests/views/popup_button.rhtml +115 -0
- data/frameworks/sproutcore/tests/views/text_field.rhtml +37 -0
- data/frameworks/sproutcore/validators/credit_card.js +92 -0
- data/frameworks/sproutcore/validators/date.js +36 -0
- data/frameworks/sproutcore/validators/email.js +29 -0
- data/frameworks/sproutcore/validators/not_empty.js +24 -0
- data/frameworks/sproutcore/validators/number.js +55 -0
- data/frameworks/sproutcore/validators/password.js +78 -0
- data/frameworks/sproutcore/validators/validator.js +304 -0
- data/frameworks/sproutcore/views/button.js +425 -0
- data/frameworks/sproutcore/views/checkbox_field.js +30 -0
- data/frameworks/sproutcore/views/collection.js +1521 -0
- data/frameworks/sproutcore/views/container.js +62 -0
- data/frameworks/sproutcore/views/error_explanation.js +45 -0
- data/frameworks/sproutcore/views/field.js +214 -0
- data/frameworks/sproutcore/views/filter_button.js +29 -0
- data/frameworks/sproutcore/views/form.js +591 -0
- data/frameworks/sproutcore/views/image.js +141 -0
- data/frameworks/sproutcore/views/inline_text_editor.js +96 -0
- data/frameworks/sproutcore/views/label.js +176 -0
- data/frameworks/sproutcore/views/menu_item.js +90 -0
- data/frameworks/sproutcore/views/pagination.js +54 -0
- data/frameworks/sproutcore/views/popup_button.js +86 -0
- data/frameworks/sproutcore/views/popup_menu.js +137 -0
- data/frameworks/sproutcore/views/progress.js +100 -0
- data/frameworks/sproutcore/views/radio_field.js +107 -0
- data/frameworks/sproutcore/views/radio_group.js +48 -0
- data/frameworks/sproutcore/views/segmented.js +80 -0
- data/frameworks/sproutcore/views/select_field.js +272 -0
- data/frameworks/sproutcore/views/spinner.js +11 -0
- data/frameworks/sproutcore/views/tab.js +126 -0
- data/frameworks/sproutcore/views/text_field.js +179 -0
- data/frameworks/sproutcore/views/textarea_field.js +14 -0
- data/frameworks/sproutcore/views/toolbar.js +29 -0
- data/frameworks/sproutcore/views/view.js +1389 -0
- data/frameworks/sproutcore/views/workspace.js +170 -0
- data/generators/client/README +3 -0
- data/generators/client/USAGE +12 -0
- data/generators/client/client_generator.rb +53 -0
- data/generators/client/templates/core.js +19 -0
- data/generators/client/templates/english.lproj/body.css +0 -0
- data/generators/client/templates/english.lproj/body.rhtml +3 -0
- data/generators/client/templates/english.lproj/controls.css +0 -0
- data/generators/client/templates/english.lproj/strings.js +14 -0
- data/generators/client/templates/main.js +37 -0
- data/generators/controller/USAGE +16 -0
- data/generators/controller/controller_generator.rb +51 -0
- data/generators/controller/templates/controller.js +21 -0
- data/generators/controller/templates/test.rhtml +21 -0
- data/generators/framework/README +7 -0
- data/generators/framework/USAGE +12 -0
- data/generators/framework/framework_generator.rb +53 -0
- data/generators/framework/templates/core.js +20 -0
- data/generators/framework/templates/english.lproj/body.css +0 -0
- data/generators/framework/templates/english.lproj/body.rhtml +3 -0
- data/generators/framework/templates/english.lproj/controls.css +0 -0
- data/generators/framework/templates/english.lproj/strings.js +14 -0
- data/generators/language/USAGE +16 -0
- data/generators/language/language_generator.rb +47 -0
- data/generators/language/templates/strings.js +10 -0
- data/generators/model/USAGE +24 -0
- data/generators/model/model_generator.rb +55 -0
- data/generators/model/templates/fixture.js +11 -0
- data/generators/model/templates/model.js +20 -0
- data/generators/model/templates/test.rhtml +21 -0
- data/generators/test/USAGE +16 -0
- data/generators/test/templates/test.rhtml +21 -0
- data/generators/test/test_generator.rb +47 -0
- data/generators/view/USAGE +16 -0
- data/generators/view/templates/test.rhtml +21 -0
- data/generators/view/templates/view.js +20 -0
- data/generators/view/view_generator.rb +51 -0
- data/jsdoc/README.txt +119 -0
- data/jsdoc/app/DocFile.js +137 -0
- data/jsdoc/app/DocTag.js +110 -0
- data/jsdoc/app/Doclet.js +63 -0
- data/jsdoc/app/Dumper.js +143 -0
- data/jsdoc/app/JsDoc.js +103 -0
- data/jsdoc/app/JsHilite.js +45 -0
- data/jsdoc/app/JsIO.js +163 -0
- data/jsdoc/app/JsParse.js +385 -0
- data/jsdoc/app/JsPlate.js +130 -0
- data/jsdoc/app/JsTestrun.js +129 -0
- data/jsdoc/app/JsToke.js +564 -0
- data/jsdoc/app/Symbol.js +298 -0
- data/jsdoc/app/Transformer.js +14 -0
- data/jsdoc/app/Util.js +97 -0
- data/jsdoc/app/js.jar +0 -0
- data/jsdoc/app/run.js +144 -0
- data/jsdoc/plugins/min.js +316 -0
- data/jsdoc/plugins/strip.js +20 -0
- data/jsdoc/templates/sproutcore/class.tmpl +438 -0
- data/jsdoc/templates/sproutcore/default.css +241 -0
- data/jsdoc/templates/sproutcore/index.html +13 -0
- data/jsdoc/templates/sproutcore/index.tmpl +21 -0
- data/jsdoc/templates/sproutcore/prototype.js +4186 -0
- data/jsdoc/templates/sproutcore/publish.js +236 -0
- data/jsdoc/templates/sproutcore/splash.html +7 -0
- data/lib/sproutcore/build_tools/html_builder.rb +88 -0
- data/lib/sproutcore/build_tools/resource_builder.rb +194 -0
- data/lib/sproutcore/build_tools.rb +44 -0
- data/lib/sproutcore/bundle.rb +517 -0
- data/lib/sproutcore/bundle_manifest.rb +397 -0
- data/lib/sproutcore/generator_helper.rb +170 -0
- data/lib/sproutcore/helpers/capture_helper.rb +42 -0
- data/lib/sproutcore/helpers/static_helper.rb +80 -0
- data/lib/sproutcore/helpers/tag_helper.rb +110 -0
- data/lib/sproutcore/helpers/text_helper.rb +336 -0
- data/lib/sproutcore/helpers.rb +3 -0
- data/lib/sproutcore/jsdoc.rb +40 -0
- data/lib/sproutcore/jsmin.rb +247 -0
- data/lib/sproutcore/library.rb +258 -0
- data/lib/sproutcore/merb/bundle_controller.rb +179 -0
- data/lib/sproutcore/merb/router.rb +43 -0
- data/lib/sproutcore/merb.rb +27 -0
- data/lib/sproutcore/version.rb +9 -0
- data/lib/sproutcore/view_helpers/button_views.rb +302 -0
- data/lib/sproutcore/view_helpers/core_views.rb +284 -0
- data/lib/sproutcore/view_helpers/form_views.rb +258 -0
- data/lib/sproutcore/view_helpers/menu_views.rb +94 -0
- data/lib/sproutcore/view_helpers.rb +628 -0
- data/lib/sproutcore.rb +30 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/sproutcore_spec.rb +11 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- metadata +365 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
<% # ========================================================================
|
|
2
|
+
# SC.Controller Unit Test
|
|
3
|
+
# ========================================================================
|
|
4
|
+
%>
|
|
5
|
+
<% content_for('final') do %>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
ControllerSetup = function() {
|
|
10
|
+
|
|
11
|
+
// stub in required method implementations.
|
|
12
|
+
this.klass = SC.Controller.extend({
|
|
13
|
+
|
|
14
|
+
// used to configure different tests.
|
|
15
|
+
isCommitEnabled: YES, isDiscardEnabled: YES,
|
|
16
|
+
isCommitSuccessful: YES, isDiscardSuccessful: YES,
|
|
17
|
+
|
|
18
|
+
changesCommitted: NO, changesDiscarded: NO,
|
|
19
|
+
|
|
20
|
+
commitChangesImmediately: NO,
|
|
21
|
+
|
|
22
|
+
canCommitChanges: function() { return this.get('isCommitEnabled') ; },
|
|
23
|
+
performCommitChanges: function() {
|
|
24
|
+
return this.changesCommitted = this.get('isCommitSuccessful') ;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
canDiscardChanges: function() { return this.get('isDiscardEnabled') ; },
|
|
28
|
+
performDiscardChanges: function() {
|
|
29
|
+
return this.changesDiscarded = this.get('isDiscardSuccessful') ;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}) ;
|
|
33
|
+
|
|
34
|
+
// create dummy
|
|
35
|
+
this.c = this.klass.create() ;
|
|
36
|
+
|
|
37
|
+
} ;
|
|
38
|
+
|
|
39
|
+
Test.context("Single SC.Controller", {
|
|
40
|
+
|
|
41
|
+
"hasChanges should be true after change": function() {
|
|
42
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
43
|
+
this.c.editorDidChange() ;
|
|
44
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
"hasChanges should be false after commit": function() {
|
|
48
|
+
this.c.editorDidChange() ;
|
|
49
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
50
|
+
this.c.commitChanges() ;
|
|
51
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
"hasChanges should be false after discard": function() {
|
|
55
|
+
this.c.editorDidChange() ;
|
|
56
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
57
|
+
this.c.discardChanges() ;
|
|
58
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
"hasChanges should be true if commit fails": function() {
|
|
62
|
+
this.c.editorDidChange() ;
|
|
63
|
+
|
|
64
|
+
// disable canCommit
|
|
65
|
+
this.c.isCommitEnabled = NO ;
|
|
66
|
+
this.c.commitChanges().shouldNotEqual(YES) ;
|
|
67
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
68
|
+
|
|
69
|
+
// disable performCommit
|
|
70
|
+
this.c.isCommitEnabled = YES ; this.c.isCommitSuccessful = NO ;
|
|
71
|
+
this.c.commitChanges().shouldNotEqual(YES) ;
|
|
72
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
"hasChanges should be true if discard fails": function() {
|
|
76
|
+
this.c.editorDidChange() ;
|
|
77
|
+
|
|
78
|
+
// disable canCommit
|
|
79
|
+
this.c.isDiscardEnabled = NO ;
|
|
80
|
+
this.c.discardChanges().shouldNotEqual(YES) ;
|
|
81
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
82
|
+
|
|
83
|
+
// disable performCommit
|
|
84
|
+
this.c.isDiscardEnabled = YES ; this.c.isDiscardSuccessful = NO ;
|
|
85
|
+
this.c.discardChanges().shouldNotEqual(YES) ;
|
|
86
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
"commit should fail if there are no changes to commit": function() {
|
|
90
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
91
|
+
$ok(this.c.commitChanges()).shouldEqual(NO) ;
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
"discard should fail if there are no changes to commit": function() {
|
|
95
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
96
|
+
$ok(this.c.discardChanges()).shouldEqual(NO) ;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
"changes should commit immediately if enabled": function() {
|
|
100
|
+
this.c.set('commitChangesImmediately', YES) ;
|
|
101
|
+
this.c.editorDidChange() ;
|
|
102
|
+
this.c._commitTimeout.shouldNotBeNull() ;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
"changes should NOT commit immediately UNLESS enabled": function() {
|
|
106
|
+
this.c.set('commitChangesImmediately', NO) ;
|
|
107
|
+
this.c.editorDidChange() ;
|
|
108
|
+
(this.c._commitTimeout == null).shouldEqual(YES) ;
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
setup: function() {
|
|
112
|
+
ControllerSetup.call(this) ;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
}) ;
|
|
116
|
+
|
|
117
|
+
Test.context("Chained SC.Controllers", {
|
|
118
|
+
|
|
119
|
+
"root.hasChanges should be true after child.change": function() {
|
|
120
|
+
this.root.get('hasChanges').shouldEqual(NO) ;
|
|
121
|
+
this.child.editorDidChange() ;
|
|
122
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
"child.hasChanges should be FALSE after root.commit": function() {
|
|
126
|
+
this.child.editorDidChange() ;
|
|
127
|
+
this.child.get('hasChanges').shouldEqual(YES) ;
|
|
128
|
+
this.root.commitChanges() ;
|
|
129
|
+
this.child.get('hasChanges').shouldEqual(NO) ;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
"child.hasChanges should be FALSE after root.discard": function() {
|
|
133
|
+
this.child.editorDidChange() ;
|
|
134
|
+
this.child.get('hasChanges').shouldEqual(YES) ;
|
|
135
|
+
this.root.discardChanges() ;
|
|
136
|
+
this.child.get('hasChanges').shouldEqual(NO) ;
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
"root.hasChanges should be FALSE after child.commit if root DOES NOT have other changes": function() {
|
|
140
|
+
// edit child only
|
|
141
|
+
this.child.editorDidChange() ;
|
|
142
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
143
|
+
|
|
144
|
+
this.child.commitChanges() ;
|
|
145
|
+
this.root.get('hasChanges').shouldEqual(NO) ;
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
"root.hasChanges should be TRUE after child.commit if root DOES have other changes": function() {
|
|
149
|
+
// edit child and root
|
|
150
|
+
this.child.editorDidChange() ;
|
|
151
|
+
this.root.editorDidChange() ;
|
|
152
|
+
|
|
153
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
154
|
+
this.child.commitChanges() ;
|
|
155
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
"root.hasChanges should be FALSE after child.discard if root DOES NOT have other changes": function() {
|
|
159
|
+
// edit child only
|
|
160
|
+
this.child.editorDidChange() ;
|
|
161
|
+
|
|
162
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
163
|
+
this.child.discardChanges() ;
|
|
164
|
+
this.root.get('hasChanges').shouldEqual(NO) ;
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
"root.hasChanges should be TRUE after child.discard if root DOES have other changes": function() {
|
|
168
|
+
// edit child and root
|
|
169
|
+
this.child.editorDidChange() ;
|
|
170
|
+
this.root.editorDidChange() ;
|
|
171
|
+
|
|
172
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
173
|
+
this.child.discardChanges() ;
|
|
174
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
"child.hasChanges should be TRUE if another child cannot commit": function() {
|
|
179
|
+
// edit child and child2
|
|
180
|
+
this.child.editorDidChange() ;
|
|
181
|
+
this.child2.editorDidChange() ;
|
|
182
|
+
|
|
183
|
+
// disable canCommit in child2
|
|
184
|
+
this.child2.isCommitEnabled = NO ;
|
|
185
|
+
|
|
186
|
+
// now try to commit. child not be committed.
|
|
187
|
+
$ok(this.root.commitChanges()).shouldEqual(NO) ;
|
|
188
|
+
|
|
189
|
+
// verify child.
|
|
190
|
+
this.child.changesCommitted.shouldEqual(NO) ;
|
|
191
|
+
this.child.get('hasChanges').shouldEqual(YES) ;
|
|
192
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
"child.hasChanges should be TRUE if another child cannot discard": function() {
|
|
196
|
+
// edit child and child2
|
|
197
|
+
this.child.editorDidChange() ;
|
|
198
|
+
this.child2.editorDidChange() ;
|
|
199
|
+
|
|
200
|
+
// disable canCommit in child2
|
|
201
|
+
this.child2.isDiscardEnabled = NO ;
|
|
202
|
+
|
|
203
|
+
// now try to commit. child not be committed.
|
|
204
|
+
$ok(this.root.discardChanges()).shouldEqual(NO) ;
|
|
205
|
+
|
|
206
|
+
// verify child.
|
|
207
|
+
this.child.changesDiscarded.shouldEqual(NO) ;
|
|
208
|
+
this.child.get('hasChanges').shouldEqual(YES) ;
|
|
209
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
"root.hasChanges should be TRUE if any child fails to commit": function() {
|
|
213
|
+
// NOTE: Commits are not atomic. IN this case, child2 fails while child1 succeeds.
|
|
214
|
+
// the hasChanges state of child2 and root must both be TRUE in this case, but
|
|
215
|
+
// child1's state is undefined. It may have commited or it may not.
|
|
216
|
+
|
|
217
|
+
this.child.editorDidChange() ;
|
|
218
|
+
this.child2.editorDidChange() ;
|
|
219
|
+
this.child2.isCommitSuccessful = NO ;
|
|
220
|
+
|
|
221
|
+
$ok(this.root.commitChanges()).shouldEqual(NO) ;
|
|
222
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
223
|
+
this.child2.get('hasChanges').shouldEqual(YES) ;
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
"root.hasChanges should be TRUE if any child fails to discard": function() {
|
|
227
|
+
// NOTE: Commits are not atomic. IN this case, child2 fails while child1 succeeds.
|
|
228
|
+
// the hasChanges state of child2 and root must both be TRUE in this case, but
|
|
229
|
+
// child1's state is undefined. It may have commited or it may not.
|
|
230
|
+
|
|
231
|
+
this.child.editorDidChange() ;
|
|
232
|
+
this.child2.editorDidChange() ;
|
|
233
|
+
this.child2.isDiscardSuccessful = NO ;
|
|
234
|
+
|
|
235
|
+
$ok(this.root.discardChanges()).shouldEqual(NO) ;
|
|
236
|
+
this.root.get('hasChanges').shouldEqual(YES) ;
|
|
237
|
+
this.child2.get('hasChanges').shouldEqual(YES) ;
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
"child.commitChangesImmediately should be inherited from the root": function()
|
|
241
|
+
{
|
|
242
|
+
var Klass = SC.Controller.extend({ commitChangesImmediately: NO });
|
|
243
|
+
|
|
244
|
+
// child created with context passed...
|
|
245
|
+
var root = Klass.create({ commitChangesImmediately: YES });
|
|
246
|
+
var child = Klass.create({ context: root });
|
|
247
|
+
root.get('commitChangesImmediately').shouldEqual(YES);
|
|
248
|
+
child.get('commitChangesImmediately').shouldEqual(YES);
|
|
249
|
+
|
|
250
|
+
// context set after creation...
|
|
251
|
+
var root = Klass.create({ commitChangesImmediately: YES });
|
|
252
|
+
var child = Klass.create();
|
|
253
|
+
root.get('commitChangesImmediately').shouldEqual(YES);
|
|
254
|
+
child.get('commitChangesImmediately').shouldEqual(NO);
|
|
255
|
+
child.set('context', root);
|
|
256
|
+
child.get('commitChangesImmediately').shouldEqual(YES);
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
// this.root is the root controller,
|
|
261
|
+
// this.child belongs to the root parent.
|
|
262
|
+
// this.child2 belongs to the root parent also. This is used only for a few tests.
|
|
263
|
+
setup: function() {
|
|
264
|
+
ControllerSetup.call(this) ;
|
|
265
|
+
this.root = this.c;
|
|
266
|
+
this.child = this.klass.create({ context: this.root }) ;
|
|
267
|
+
this.child2 = this.klass.create({ context: this.root }) ;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
}) ;
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<% end %>
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
<% # ========================================================================
|
|
2
|
+
# SC.ObjectController Unit Test
|
|
3
|
+
# ========================================================================
|
|
4
|
+
%>
|
|
5
|
+
<% content_for('final') do %>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
// An ObjectController will make a content object or an array of content objects
|
|
10
|
+
Test.context("SC.ObjectController", {
|
|
11
|
+
|
|
12
|
+
"hasNoContent should be true when content != null and false otherwise": function() {
|
|
13
|
+
this.c.set('content', null) ;
|
|
14
|
+
this.c.get('hasNoContent').shouldEqual(YES) ;
|
|
15
|
+
|
|
16
|
+
this.c.set('content', this.single) ;
|
|
17
|
+
this.c.get('hasNoContent').shouldEqual(NO) ;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"hasSingleContent should be true only when content is a single object": function() {
|
|
21
|
+
this.c.set('content', null) ;
|
|
22
|
+
this.c.get('hasSingleContent').shouldEqual(NO) ;
|
|
23
|
+
|
|
24
|
+
this.c.set('content', this.single) ;
|
|
25
|
+
this.c.get('hasSingleContent').shouldEqual(YES) ;
|
|
26
|
+
|
|
27
|
+
this.c.set('content', this.single_a) ;
|
|
28
|
+
this.c.get('hasSingleContent').shouldEqual(YES) ;
|
|
29
|
+
|
|
30
|
+
this.c.set('content', this.multiple) ;
|
|
31
|
+
this.c.get('hasSingleContent').shouldEqual(NO) ;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"hasMultipleContent should be true when content = array with multiple items": function() {
|
|
35
|
+
this.c.set('content', null) ;
|
|
36
|
+
this.c.get('hasMultipleContent').shouldEqual(NO) ;
|
|
37
|
+
|
|
38
|
+
this.c.set('content', this.single) ;
|
|
39
|
+
this.c.get('hasMultipleContent').shouldEqual(NO) ;
|
|
40
|
+
|
|
41
|
+
this.c.set('content', this.single_a) ;
|
|
42
|
+
this.c.get('hasMultipleContent').shouldEqual(NO) ;
|
|
43
|
+
|
|
44
|
+
this.c.set('content', this.multiple) ;
|
|
45
|
+
this.c.get('hasMultipleContent').shouldEqual(YES) ;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"GET EMPTY: properties should return null": function() {
|
|
49
|
+
this.c.set('content', null) ;
|
|
50
|
+
(this.c.get('test') == null).shouldEqual(YES) ;
|
|
51
|
+
(this.c.get('value') == null).shouldEqual(YES) ;
|
|
52
|
+
(this.c.get('flag') == null).shouldEqual(YES) ;
|
|
53
|
+
(this.c.get('array') == null).shouldEqual(YES) ;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
"GET EMPTY ARRAY: properties should return null": function() {
|
|
57
|
+
this.c.set('content', this.empty_a) ;
|
|
58
|
+
(this.c.get('test') == null).shouldEqual(YES) ;
|
|
59
|
+
(this.c.get('value') == null).shouldEqual(YES) ;
|
|
60
|
+
(this.c.get('flag') == null).shouldEqual(YES) ;
|
|
61
|
+
(this.c.get('array') == null).shouldEqual(YES) ;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
"GET SINGLE: should return properties of content": function() {
|
|
65
|
+
this.c.set('content', this.single) ;
|
|
66
|
+
|
|
67
|
+
this.c.get('test').shouldEqual('NAME0') ;
|
|
68
|
+
this.c.get('value').shouldEqual(0) ;
|
|
69
|
+
this.c.get('flag').shouldEqual(YES) ;
|
|
70
|
+
this.c.get('array').shouldEqualEnum([0,0,0]) ;
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
"GET SINGLE ARRAY: should return properties of first content object": function() {
|
|
74
|
+
this.c.set('content', this.single_a) ;
|
|
75
|
+
|
|
76
|
+
this.c.get('test').shouldEqual('NAME0') ;
|
|
77
|
+
this.c.get('value').shouldEqual(0) ;
|
|
78
|
+
this.c.get('flag').shouldEqual(YES) ;
|
|
79
|
+
this.c.get('array').shouldEqualEnum([0,0,0]) ;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
"GET MULTIPLE: should return arrays with values from each content object": function() {
|
|
83
|
+
this.c.set('content', this.multiple) ;
|
|
84
|
+
|
|
85
|
+
this.c.get('test').shouldEqualEnum(['NAME0', 'NAME1']) ;
|
|
86
|
+
this.c.get('value').shouldEqualEnum([0,1]) ;
|
|
87
|
+
this.c.get('flag').shouldEqualEnum([YES, NO]) ;
|
|
88
|
+
|
|
89
|
+
// get('array').shouldEqual: [ [0,0,0], [1,1,1] ];
|
|
90
|
+
var ar = this.c.get('array') ;
|
|
91
|
+
ar.length.shouldEqual(2) ;
|
|
92
|
+
ar[0].shouldEqualEnum([0,0,0]) ;
|
|
93
|
+
ar[1].shouldEqualEnum([1,1,1]) ;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
"GET CONTROLLER FOR VALUE: should return a controller for the requested value if one exists": function()
|
|
97
|
+
{
|
|
98
|
+
this.c.set('content', this.single);
|
|
99
|
+
|
|
100
|
+
this.c.get('test').shouldEqual('NAME0');
|
|
101
|
+
this.c.get('testController').shouldEqual('NAME0');
|
|
102
|
+
|
|
103
|
+
this.c.get('value').shouldEqual(0);
|
|
104
|
+
this.c.get('valueController').shouldEqual(0);
|
|
105
|
+
|
|
106
|
+
this.c.get('flag').shouldEqual(YES);
|
|
107
|
+
this.c.get('flagController').shouldEqual(YES);
|
|
108
|
+
|
|
109
|
+
this.c.get('array').shouldEqualEnum([0,0,0]);
|
|
110
|
+
this.c.get('arrayController').instanceOf( SC.ArrayController ).shouldEqual(YES);
|
|
111
|
+
|
|
112
|
+
this.c.get('object').instanceOf( SC.Object ).shouldEqual(YES);
|
|
113
|
+
this.c.get('objectController').instanceOf( SC.ObjectController ).shouldEqual(YES);
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
"SET should notify observers of valueController properties": function()
|
|
117
|
+
{
|
|
118
|
+
this.c.set('content', this.single);
|
|
119
|
+
|
|
120
|
+
var observer = new Test.Observer;
|
|
121
|
+
this.c.addObserver( 'objectController', observer );
|
|
122
|
+
this.c.set('object', SC.Object.create({ test: "NAME12" }));
|
|
123
|
+
observer.notified.shouldEqual(1);
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
"SET value should reset the valueController property": function()
|
|
127
|
+
{
|
|
128
|
+
this.c.set('content', this.single);
|
|
129
|
+
|
|
130
|
+
this.c.set('array', this.single_a);
|
|
131
|
+
this.c.get('arrayController').get('length').shouldEqual(1);
|
|
132
|
+
this.c.set('array', this.empty_a);
|
|
133
|
+
this.c.get('arrayController').get('length').shouldEqual(0);
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
"SET controller content should reset all valueController properties": function()
|
|
137
|
+
{
|
|
138
|
+
this.c.set('content', SC.Object.create({ array: [1,2,3] }));
|
|
139
|
+
this.c.get('arrayController').get('length').shouldEqual(3);
|
|
140
|
+
|
|
141
|
+
this.c.set('content', SC.Object.create({ array: [1] }));
|
|
142
|
+
this.c.get('arrayController').get('length').shouldEqual(1);
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
"SET with no autocommit should store in controller, but not in source object": function() {
|
|
146
|
+
|
|
147
|
+
this.c.set('content', this.single) ;
|
|
148
|
+
this.c.get('test').shouldEqual('NAME0') ;
|
|
149
|
+
|
|
150
|
+
// edit the content, but don't save.
|
|
151
|
+
this.c.set('test', 'NAME1') ;
|
|
152
|
+
|
|
153
|
+
this.c.get('hasChanges').shouldEqual(YES) ;
|
|
154
|
+
this.c.get('test').shouldEqual('NAME1') ;
|
|
155
|
+
this.single.get('test').shouldEqual('NAME0') ;
|
|
156
|
+
|
|
157
|
+
// save content.
|
|
158
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
159
|
+
|
|
160
|
+
this.c.get('hasChanges').shouldEqual(NO) ;
|
|
161
|
+
this.c.get('test').shouldEqual('NAME1') ;
|
|
162
|
+
this.single.get('test').shouldEqual('NAME1') ;
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
"SET on null content should allow set but return error on commit": function() {
|
|
166
|
+
this.c.set('content', null) ;
|
|
167
|
+
this.c.set('test', 'NAME1') ;
|
|
168
|
+
|
|
169
|
+
$ok(this.c.commitChanges()).shouldEqual(NO) ;
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
"SET on empty array content should allow set but return error on commit": function() {
|
|
173
|
+
this.c.set('content', this.empty_a) ;
|
|
174
|
+
this.c.set('test', 'NAME1') ;
|
|
175
|
+
|
|
176
|
+
$ok(this.c.commitChanges()).shouldEqual(NO) ;
|
|
177
|
+
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
"SET on single array should copy values to object on commit": function() {
|
|
181
|
+
this.c.set('content', this.single) ;
|
|
182
|
+
this.c.set('test','NAME1') ;
|
|
183
|
+
|
|
184
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
185
|
+
this.single.get('test').shouldEqual('NAME1') ;
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
"SET on single-item array should copy values to object on commit": function() {
|
|
189
|
+
this.c.set('content', this.single_a) ;
|
|
190
|
+
this.c.set('test','NAME1') ;
|
|
191
|
+
|
|
192
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
193
|
+
this.single_a[0].get('test').shouldEqual('NAME1') ;
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
"SET on multiple with array values should copy value to content object at the same index": function() {
|
|
197
|
+
this.c.set('content', this.multiple) ;
|
|
198
|
+
this.c.set('test', ['NAME2','NAME3'] ) ;
|
|
199
|
+
|
|
200
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
201
|
+
this.multiple[0].get('test').shouldEqual('NAME2') ;
|
|
202
|
+
this.multiple[1].get('test').shouldEqual('NAME3') ;
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
"SET on multiple with a non-array value should copy same value to each content object": function() {
|
|
206
|
+
this.c.set('content', this.multiple) ;
|
|
207
|
+
this.c.set('test', 'NAME2') ;
|
|
208
|
+
|
|
209
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
210
|
+
this.multiple[0].get('test').shouldEqual('NAME2') ;
|
|
211
|
+
this.multiple[1].get('test').shouldEqual('NAME2') ;
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
"Calling performDiscardChanges() should notify property observers of a change": function()
|
|
215
|
+
{
|
|
216
|
+
var observer = new Test.Observer;
|
|
217
|
+
|
|
218
|
+
this.c.set('content', this.single);
|
|
219
|
+
this.c.addObserver( 'test', observer );
|
|
220
|
+
|
|
221
|
+
// set the property
|
|
222
|
+
this.c.set('test', 'NAME2');
|
|
223
|
+
this.c.get('hasChanges').shouldEqual(YES);
|
|
224
|
+
observer.notified.shouldEqual(1);
|
|
225
|
+
|
|
226
|
+
this.c.performDiscardChanges();
|
|
227
|
+
this.c.get('hasChanges').shouldEqual(NO);
|
|
228
|
+
observer.notified.shouldEqual(2);
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
"Support commitChanges() on content objects": function() {
|
|
232
|
+
this.c.set('content', this.single) ;
|
|
233
|
+
this.c.set('test', 'NAME2') ;
|
|
234
|
+
|
|
235
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
236
|
+
this.single.didCommitChanges.shouldEqual(YES) ;
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
"Support content objects that implement SC.Array but are not arrays": function() {
|
|
240
|
+
this.c.set('content', this.dummy_a) ;
|
|
241
|
+
|
|
242
|
+
// test initial content
|
|
243
|
+
this.c.get('test').shouldEqualEnum(['NAME0', 'NAME1']) ;
|
|
244
|
+
this.c.get('value').shouldEqualEnum([0,1]) ;
|
|
245
|
+
this.c.get('flag').shouldEqualEnum([YES, NO]) ;
|
|
246
|
+
|
|
247
|
+
// get('array').shouldEqual: [ [0,0,0], [1,1,1] ];
|
|
248
|
+
var ar = this.c.get('array') ;
|
|
249
|
+
ar.length.shouldEqual(2) ;
|
|
250
|
+
ar[0].shouldEqualEnum([0,0,0]) ;
|
|
251
|
+
ar[1].shouldEqualEnum([1,1,1]) ;
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
// test changing contents
|
|
255
|
+
this.c.set('test', 'NAME2') ;
|
|
256
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
257
|
+
this.dummy_a.objectAt(0).get('test').shouldEqual('NAME2') ;
|
|
258
|
+
this.dummy_a.objectAt(0).get('test').shouldEqual('NAME2') ;
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
"Support content objects that are not Observable": function() {
|
|
262
|
+
var obj = {
|
|
263
|
+
test: 'NAME0', value: 0, flag: YES, array: [0,0,0],
|
|
264
|
+
|
|
265
|
+
commitChanges: function() {
|
|
266
|
+
this.didCommitChanges = YES ;
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
didCommitChanges: NO
|
|
270
|
+
} ;
|
|
271
|
+
|
|
272
|
+
this.c.set('content', obj);
|
|
273
|
+
this.c.get('test').shouldEqual('NAME0') ;
|
|
274
|
+
|
|
275
|
+
this.c.set('test', 'NAME1') ;
|
|
276
|
+
$ok(this.c.commitChanges()).shouldEqual(YES) ;
|
|
277
|
+
|
|
278
|
+
obj.test.shouldEqual('NAME1') ;
|
|
279
|
+
obj.didCommitChanges.shouldEqual(YES) ;
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
setup: function() {
|
|
283
|
+
this.c = SC.ObjectController.create() ;
|
|
284
|
+
|
|
285
|
+
this.single = SC.Object.create({
|
|
286
|
+
test: 'NAME0', value: 0, flag: YES, array: [0,0,0],
|
|
287
|
+
object: SC.Object.create({ test: 'NAME1', value: 1, flag: NO, array: [1,1,1] }),
|
|
288
|
+
|
|
289
|
+
commitChanges: function() {
|
|
290
|
+
this.didCommitChanges = YES ;
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
didCommitChanges: NO
|
|
294
|
+
}) ;
|
|
295
|
+
|
|
296
|
+
this.multiple = [
|
|
297
|
+
SC.Object.create({ test: 'NAME0', value: 0, flag: YES, array: [0,0,0] }),
|
|
298
|
+
SC.Object.create({ test: 'NAME1', value: 1, flag: NO, array: [1,1,1] })
|
|
299
|
+
] ;
|
|
300
|
+
|
|
301
|
+
this.single_a = [
|
|
302
|
+
SC.Object.create({ test: 'NAME0', value: 0, flag: YES, array: [0,0,0] })
|
|
303
|
+
] ;
|
|
304
|
+
|
|
305
|
+
this.empty_a = [] ;
|
|
306
|
+
|
|
307
|
+
this.dummy_a = SC.Object.create(SC.Array, {
|
|
308
|
+
length: 2,
|
|
309
|
+
|
|
310
|
+
replace: function(idx, amt, objects) {
|
|
311
|
+
this._items.replace(idx,amt,objects) ;
|
|
312
|
+
this.set('length', this._items.length) ;
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
objectAt: function(idx) {
|
|
316
|
+
return this._items.objectAt(idx) ;
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
_items: this.multiple
|
|
320
|
+
}) ;
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
}) ;
|
|
324
|
+
|
|
325
|
+
</script>
|
|
326
|
+
|
|
327
|
+
<% end %>
|