sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/VERSION.yml +1 -1
- data/bin/sc-docs +6 -1
- data/lib/buildtasks/target.rake +1 -1
- data/lib/frameworks/sproutcore/Buildfile +5 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
- data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
- data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
- 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/runtime/system/range_observer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
- data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
- data/lib/sproutcore/builders/base.rb +5 -1
- data/lib/sproutcore/builders/handlebars.rb +12 -1
- data/lib/sproutcore/models/target.rb +1 -9
- data/lib/sproutcore/rack/proxy.rb +238 -92
- data/lib/sproutcore/tools/docs.rb +1 -7
- data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
- data/spec/lib/builders/handlebars_spec.rb +10 -4
- data/sproutcore.gemspec +3 -1
- metadata +73 -44
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
@@ -69,6 +69,42 @@ test("isEnabled=NO should add disabled class", function() {
|
|
69
69
|
ok(view.$().hasClass('disabled'), 'should have disabled class');
|
70
70
|
});
|
71
71
|
|
72
|
+
test("isEnabled=NO isEditable=NO should add disabled attribute", function() {
|
73
|
+
SC.RunLoop.begin();
|
74
|
+
view.set('isEnabled', NO);
|
75
|
+
view.set('isEditable', NO);
|
76
|
+
SC.RunLoop.end();
|
77
|
+
ok(view.$input().attr('disabled'), 'should have disabled attribute');
|
78
|
+
ok(!view.$input().attr('readOnly'), 'should not have readOnly attribute');
|
79
|
+
});
|
80
|
+
|
81
|
+
test("isEnabled=NO isEditable=YES should add disabled attribute", function() {
|
82
|
+
SC.RunLoop.begin();
|
83
|
+
view.set('isEnabled', NO);
|
84
|
+
view.set('isEditable', YES);
|
85
|
+
SC.RunLoop.end();
|
86
|
+
ok(view.$input().attr('disabled'), 'should have disabled attribute');
|
87
|
+
ok(!view.$input().attr('readOnly'), 'should not have readOnly attribute');
|
88
|
+
});
|
89
|
+
|
90
|
+
test("isEnabled=YES isEditable=NO should add readOnly attribute", function() {
|
91
|
+
SC.RunLoop.begin();
|
92
|
+
view.set('isEnabled', YES);
|
93
|
+
view.set('isEditable', NO);
|
94
|
+
SC.RunLoop.end();
|
95
|
+
ok(!view.$input().attr('disabled'), 'should not have disabled attribute');
|
96
|
+
ok(view.$input().attr('readOnly'), 'should have readOnly attribute');
|
97
|
+
});
|
98
|
+
|
99
|
+
test("isEnabled=YES isEditable=YES should not add disable or readOnly attribute", function() {
|
100
|
+
SC.RunLoop.begin();
|
101
|
+
view.set('isEnabled', YES);
|
102
|
+
view.set('isEditable', YES);
|
103
|
+
SC.RunLoop.end();
|
104
|
+
ok(!view.$input().attr('disabled'), 'should not have disabled attribute');
|
105
|
+
ok(!view.$input().attr('readOnly'), 'should not have readOnly attribute');
|
106
|
+
});
|
107
|
+
|
72
108
|
// test("isEnabled=NO should add disabled attr to input", function() {
|
73
109
|
// SC.RunLoop.begin();
|
74
110
|
// view1.set('isEnabled', NO);
|
@@ -78,10 +114,3 @@ test("isEnabled=NO should add disabled class", function() {
|
|
78
114
|
// ok(view1.get('value') === 'SproutCore', 'value cannot be changed');
|
79
115
|
// });
|
80
116
|
|
81
|
-
test("isEnabled and isEditable mapping", function() {
|
82
|
-
var obj= SC.TextFieldView.create();
|
83
|
-
obj.set('isEnabled',false);
|
84
|
-
equals(obj.get('isEditable'),false);
|
85
|
-
obj.set('isEnabled',true);
|
86
|
-
equals(obj.get('isEditable'),true);
|
87
|
-
});
|
@@ -32,13 +32,22 @@
|
|
32
32
|
.add("disabled - empty", SC.TextFieldView, {
|
33
33
|
hint: "Full Name",
|
34
34
|
value: null,
|
35
|
-
isEnabled: NO
|
35
|
+
isEnabled: NO,
|
36
|
+
isEditable: NO
|
36
37
|
})
|
37
38
|
|
38
39
|
.add("disabled - with value", SC.TextFieldView, {
|
39
40
|
hint: "Full Name",
|
40
41
|
value: 'John Doe',
|
41
|
-
isEnabled: NO
|
42
|
+
isEnabled: NO,
|
43
|
+
isEditable: NO
|
44
|
+
})
|
45
|
+
|
46
|
+
.add("enabled - not editable - with value", SC.TextFieldView, {
|
47
|
+
hint: "Full Name",
|
48
|
+
value: 'John Doe',
|
49
|
+
isEnabled: YES,
|
50
|
+
isEditable: NO
|
42
51
|
})
|
43
52
|
|
44
53
|
.add("textarea - empty", SC.TextFieldView, {
|
@@ -81,13 +90,21 @@
|
|
81
90
|
isEnabled: YES
|
82
91
|
})
|
83
92
|
|
84
|
-
.add("aria-disabled",SC.TextFieldView, {
|
93
|
+
.add("aria-disabled", SC.TextFieldView, {
|
85
94
|
hint: "Full Name",
|
86
95
|
value: 'John Doe',
|
87
96
|
isTextArea: YES,
|
88
97
|
isEnabled: NO
|
89
98
|
})
|
90
99
|
|
100
|
+
.add("aria-readonly", SC.TextFieldView, {
|
101
|
+
hint: "Full Name",
|
102
|
+
value: 'John Doe',
|
103
|
+
isTextArea: YES,
|
104
|
+
isEnabled: YES,
|
105
|
+
isEditable: NO
|
106
|
+
})
|
107
|
+
|
91
108
|
.add("aria-invalid", SC.TextFieldView, {
|
92
109
|
value: SC.Error.create({errorValue:'Error Message'}),
|
93
110
|
isEnabled: YES
|
@@ -104,7 +121,7 @@ pane.verifyEmpty = function verifyEmpty(view, expectedHint) {
|
|
104
121
|
|
105
122
|
ok(!layer.hasClass('not-empty'), 'layer should not have not-empty class');
|
106
123
|
if(SC.browser.webkit || parseInt(SC.browser.mozilla) >= 2.0) equals(input.val(), '', 'input should have empty value');
|
107
|
-
else equals(input.val(), expectedHint, 'input should have
|
124
|
+
else equals(input.val(), expectedHint, 'input should have expected hint as value');
|
108
125
|
if (expectedHint) {
|
109
126
|
var hint = view.$('.sc-hint');
|
110
127
|
if (hint.length===1) {
|
@@ -149,6 +166,15 @@ pane.verifyDisabled = function verifyDisabled(view, isDisabled) {
|
|
149
166
|
}
|
150
167
|
};
|
151
168
|
|
169
|
+
pane.verifyReadOnly = function verifyReadonly(view, isReadOnly) {
|
170
|
+
var input = view.$('input');
|
171
|
+
|
172
|
+
if(isReadOnly) {
|
173
|
+
ok(input.attr('readOnly'), 'input should have readOnly attr');
|
174
|
+
} else {
|
175
|
+
ok(!input.attr('readOnly'), 'input should not have readOnly attr');
|
176
|
+
}
|
177
|
+
};
|
152
178
|
|
153
179
|
// ..........................................................
|
154
180
|
// TEST INITIAL STATES
|
@@ -192,6 +218,12 @@ test("disabled - with value", function() {
|
|
192
218
|
pane.verifyDisabled(view, YES);
|
193
219
|
});
|
194
220
|
|
221
|
+
test("enabled - not editable - with value", function() {
|
222
|
+
var view = pane.view('enabled - not editable - with value');
|
223
|
+
pane.verifyNotEmpty(view, 'John Doe', 'Full Name');
|
224
|
+
pane.verifyReadOnly(view, YES);
|
225
|
+
});
|
226
|
+
|
195
227
|
test("textarea - empty", function() {
|
196
228
|
var view = pane.view('empty');
|
197
229
|
pane.verifyEmpty(view, 'Full Name');
|
@@ -261,6 +293,22 @@ test("enabling disabled view", function() {
|
|
261
293
|
pane.verifyDisabled(view, NO);
|
262
294
|
});
|
263
295
|
|
296
|
+
test("changing isEditable", function() {
|
297
|
+
var view = pane.view('enabled - not editable - with value');
|
298
|
+
|
299
|
+
// test changing isEditable state updates like it should
|
300
|
+
SC.RunLoop.begin();
|
301
|
+
view.set('isEditable', YES);
|
302
|
+
SC.RunLoop.end();
|
303
|
+
pane.verifyReadOnly(view, NO);
|
304
|
+
|
305
|
+
// test changing isEditable state updates like it should
|
306
|
+
SC.RunLoop.begin();
|
307
|
+
view.set('isEditable', NO);
|
308
|
+
SC.RunLoop.end();
|
309
|
+
pane.verifyReadOnly(view, YES);
|
310
|
+
});
|
311
|
+
|
264
312
|
if (!SC.browser.isIE && !SC.platform.input.placeholder) {
|
265
313
|
test("Changing value to null -- password field", function() {
|
266
314
|
var view = pane.view('password-hint'),
|
@@ -606,6 +654,12 @@ test("should have aria-disabled as YES", function() {
|
|
606
654
|
equals(label.attr('aria-disabled'), 'true', 'aria-disabled should be true');
|
607
655
|
});
|
608
656
|
|
657
|
+
test("should have aria-readonly as YES", function() {
|
658
|
+
var view = pane.view('aria-readonly');
|
659
|
+
var label = view.$();
|
660
|
+
equals(label.attr('aria-readonly'), 'true', 'aria-readonly should be true');
|
661
|
+
});
|
662
|
+
|
609
663
|
test("should have aria-invalid as YES", function() {
|
610
664
|
var view = pane.view('aria-invalid');
|
611
665
|
var label = view.$();
|
@@ -18,7 +18,7 @@ SC.VALIDATE_NO_CHANGE = NO;
|
|
18
18
|
"validate" attribute in your text field. For example, if you want to
|
19
19
|
validate a field using the PhoneNumberValidator use this:
|
20
20
|
|
21
|
-
|
21
|
+
<input value="1234567890" validate="phone-number" />
|
22
22
|
|
23
23
|
Validators get notified at three points. You can implement one or all
|
24
24
|
of these methods to support validation. All of the validate methods except
|
@@ -28,10 +28,8 @@ SC.VALIDATE_NO_CHANGE = NO;
|
|
28
28
|
following:
|
29
29
|
|
30
30
|
1. You can simply validate the field value and return OK or an error str
|
31
|
-
|
32
31
|
2. You can modify the field value (for example, you could format the
|
33
32
|
string to match some predefined format).
|
34
|
-
|
35
33
|
3. If you need to roundtrip the server first to perform validation, you can
|
36
34
|
return Validator.OK, then save the form and field info until after the
|
37
35
|
roundtrip. On return, if there is a problem, first verify the field
|
@@ -288,21 +288,6 @@ SC.FieldView = SC.View.extend(SC.Control, SC.Validatable,
|
|
288
288
|
if (SC.FOCUS_ALL_CONTROLS) { return this.get('isEnabled'); }
|
289
289
|
return NO;
|
290
290
|
}.property('isEnabled'),
|
291
|
-
|
292
|
-
willBecomeKeyResponderFrom: function(keyView) {
|
293
|
-
// focus the text field.
|
294
|
-
if (!this._isFocused) {
|
295
|
-
this._isFocused = YES ;
|
296
|
-
this.becomeFirstResponder();
|
297
|
-
if (this.get('isVisibleInWindow')) {
|
298
|
-
this.$input()[0].focus();
|
299
|
-
}
|
300
|
-
}
|
301
|
-
},
|
302
|
-
|
303
|
-
willLoseKeyResponderTo: function(responder) {
|
304
|
-
if (this._isFocused) this._isFocused = NO ;
|
305
|
-
},
|
306
291
|
|
307
292
|
// these methods use the validator to convert the raw field value returned
|
308
293
|
// by your subclass into an object and visa versa.
|
@@ -59,7 +59,7 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
59
59
|
|
60
60
|
@property {String} SC.REGULAR_WEIGHT|SC.BOLD_WEIGHT
|
61
61
|
@default null
|
62
|
-
@deprecated
|
62
|
+
@deprecated Use CSS instead.
|
63
63
|
*/
|
64
64
|
fontWeight: null,
|
65
65
|
|
@@ -114,7 +114,7 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
114
114
|
|
115
115
|
@property {String} SC.ALIGN_LEFT|SC.ALIGN_CENTER|SC.ALIGN_RIGHT
|
116
116
|
@default null
|
117
|
-
@deprecated
|
117
|
+
@deprecated Use CSS instead.
|
118
118
|
*/
|
119
119
|
textAlign: null,
|
120
120
|
|
@@ -122,8 +122,8 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
122
122
|
isContextMenuEnabled: YES,
|
123
123
|
|
124
124
|
/**
|
125
|
-
@deprecated
|
126
|
-
|
125
|
+
@deprecated Use #applyImmediately instead.
|
126
|
+
|
127
127
|
If true, every change to the text in the text field updates 'value'.
|
128
128
|
If false, 'value' is only updated when commitEditing() is called (this
|
129
129
|
is called automatically when the text field loses focus), or whenever
|
@@ -253,10 +253,16 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
253
253
|
return sc_super();
|
254
254
|
},
|
255
255
|
|
256
|
-
/**
|
257
|
-
|
258
|
-
|
259
|
-
|
256
|
+
/**
|
257
|
+
This property indicates if the value in the text field can be changed.
|
258
|
+
If set to NO, a readOnly attribute will be added to the DOM Element.
|
259
|
+
|
260
|
+
Note if isEnabled is NO this property will have no effect.
|
261
|
+
|
262
|
+
@property
|
263
|
+
@type Boolean
|
264
|
+
*/
|
265
|
+
isEditable: YES,
|
260
266
|
|
261
267
|
/**
|
262
268
|
The current selection of the text field, returned as an SC.TextSelection
|
@@ -369,7 +375,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
369
375
|
// INTERNAL SUPPORT
|
370
376
|
//
|
371
377
|
|
372
|
-
displayProperties: ['formattedHint', 'fieldValue', 'isEditing', 'leftAccessoryView', 'rightAccessoryView', 'isTextArea'],
|
378
|
+
displayProperties: ['formattedHint', 'fieldValue', 'isEditing', 'isEditable', 'leftAccessoryView', 'rightAccessoryView', 'isTextArea'],
|
373
379
|
|
374
380
|
createChildViews: function() {
|
375
381
|
sc_super();
|
@@ -478,6 +484,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
478
484
|
if(firstTime) {
|
479
485
|
context.attr('aria-multiline', this.get('isTextArea'));
|
480
486
|
context.attr('aria-disabled', !this.get('isEnabled'));
|
487
|
+
context.attr('aria-readonly', this.get('isEnabled') && !this.get('isEditable'));
|
481
488
|
}
|
482
489
|
if(!SC.ok(this.get('value'))) {
|
483
490
|
context.attr('aria-invalid', YES);
|
@@ -517,7 +524,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
517
524
|
// here, but currently SC.RenderContext will render sibling
|
518
525
|
// contexts as parent/child.
|
519
526
|
|
520
|
-
var hint = this.get('formattedHint'),
|
527
|
+
var hint = this.get('formattedHint'), activeState, name, adjustmentStyle, type,
|
521
528
|
hintElements, element, paddingElementStyle, fieldClassNames,
|
522
529
|
spellCheckEnabled=this.get('spellCheckEnabled'), spellCheckString,
|
523
530
|
maxLength = this.get('maxLength'), isOldSafari;
|
@@ -532,7 +539,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
532
539
|
spellCheckString = spellCheckEnabled ? ' spellcheck="true"' : ' spellcheck="false"';
|
533
540
|
if (firstTime || this._forceRenderFirstTime) {
|
534
541
|
this._forceRenderFirstTime = NO;
|
535
|
-
|
542
|
+
activeState = this.get('isEnabled') ? (this.get('isEditable') ? '' : 'readonly="readonly"') : 'disabled="disabled"' ;
|
536
543
|
name = this.get('layerId');
|
537
544
|
|
538
545
|
if(this.get('shouldRenderBorder')) context.push('<span class="border"></span>');
|
@@ -564,7 +571,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
564
571
|
// Render the input/textarea field itself, and close off the padding.
|
565
572
|
if (this.get('isTextArea')) {
|
566
573
|
context.push('<textarea class="',fieldClassNames,'" name="', name,
|
567
|
-
'" ',
|
574
|
+
'" ', activeState, ' placeholder="',hint, '"',
|
568
575
|
spellCheckString,' maxlength="', maxLength, '">',
|
569
576
|
value, '</textarea></span>') ;
|
570
577
|
}
|
@@ -576,7 +583,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
576
583
|
if (this.get('isPassword') && (value !== hint || SC.browser.isIE || SC.platform.input.placeholder)) { type = 'password'; }
|
577
584
|
|
578
585
|
context.push('<input class="',fieldClassNames,'" type="', type,
|
579
|
-
'" name="', name, '" ',
|
586
|
+
'" name="', name, '" ', activeState, ' value="', value,
|
580
587
|
'" placeholder="',hint,'"', spellCheckString,
|
581
588
|
' maxlength="', maxLength, '" /></span>') ;
|
582
589
|
}
|
@@ -615,9 +622,13 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
615
622
|
if (element) {
|
616
623
|
if (!this.get('isEnabled')) {
|
617
624
|
element.disabled = 'true' ;
|
618
|
-
|
619
|
-
else {
|
625
|
+
element.readOnly = null ;
|
626
|
+
} else if(!this.get('isEditable')) {
|
627
|
+
element.disabled = null ;
|
628
|
+
element.readOnly = 'true' ;
|
629
|
+
} else {
|
620
630
|
element.disabled = null ;
|
631
|
+
element.readOnly = null ;
|
621
632
|
}
|
622
633
|
|
623
634
|
// Adjust the padding element to accommodate any accessory views.
|
@@ -920,7 +931,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
920
931
|
When we become first responder, focus the text field if needed and
|
921
932
|
hide the hint text.
|
922
933
|
*/
|
923
|
-
|
934
|
+
didBecomeKeyResponderFrom: function(keyView) {
|
924
935
|
if(this.get('isVisibleInWindow')) {
|
925
936
|
var inp = this.$input()[0];
|
926
937
|
try{
|
@@ -1389,7 +1389,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1389
1389
|
|
1390
1390
|
var reservedWords = ("break case catch continue default delete do else finally " +
|
1391
1391
|
"for function if in instanceof new return switch this throw " +
|
1392
|
-
"try typeof var void while with null true false").split(" ");
|
1392
|
+
"try typeof var void while with null true false extends").split(" ");
|
1393
1393
|
|
1394
1394
|
compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
|
1395
1395
|
|
@@ -39,7 +39,7 @@ window.SproutCore = window.SproutCore || SC ;
|
|
39
39
|
// rest of the methods go into the mixin defined below.
|
40
40
|
|
41
41
|
/**
|
42
|
-
@version 1.6.0
|
42
|
+
@version 1.6.0
|
43
43
|
@namespace
|
44
44
|
|
45
45
|
All SproutCore methods and functions are defined
|
@@ -59,7 +59,7 @@ window.SproutCore = window.SproutCore || SC ;
|
|
59
59
|
*/
|
60
60
|
SC = window.SC; // This is dumb but necessary for jsdoc to get it right
|
61
61
|
|
62
|
-
SC.VERSION = '1.6.0
|
62
|
+
SC.VERSION = '1.6.0';
|
63
63
|
|
64
64
|
/**
|
65
65
|
@private
|
@@ -189,7 +189,8 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
189
189
|
SC.T_ARRAY: An instance of Array,<br>
|
190
190
|
SC.T_CLASS: A SproutCore class (created using SC.Object.extend()),<br>
|
191
191
|
SC.T_OBJECT: A SproutCore object instance,<br>
|
192
|
-
SC.T_HASH: A JavaScript object not inheriting from SC.Object
|
192
|
+
SC.T_HASH: A JavaScript object not inheriting from SC.Object, <br>
|
193
|
+
SC.T_ERROR: A SproutCore SC.Error object <br>
|
193
194
|
*/
|
194
195
|
typeOf: function(item) {
|
195
196
|
if (item === undefined) return SC.T_UNDEFINED ;
|
@@ -200,16 +201,21 @@ SC.mixin(/** @scope window.SC.prototype */ {
|
|
200
201
|
if (nativeType === "function") {
|
201
202
|
return item.isClass ? SC.T_CLASS : SC.T_FUNCTION;
|
202
203
|
} else if (nativeType === "object") {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
204
|
+
|
205
|
+
// Note: typeOf() may be called before SC.Error has had a chance to load
|
206
|
+
// so this code checks for the presence of SC.Error first just to make
|
207
|
+
// sure. No error instance can exist before the class loads anyway so
|
208
|
+
// this is safe.
|
209
|
+
if (SC.Error && (item instanceof SC.Error)) {
|
210
|
+
return SC.T_ERROR;
|
211
|
+
} else if (item instanceof SC.Object) {
|
212
|
+
return SC.T_OBJECT;
|
207
213
|
} else {
|
208
|
-
return SC.T_HASH
|
214
|
+
return SC.T_HASH;
|
209
215
|
}
|
210
216
|
}
|
211
217
|
|
212
|
-
return nativeType
|
218
|
+
return nativeType;
|
213
219
|
},
|
214
220
|
|
215
221
|
/**
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore Costello - Property Observing Library
|
3
|
+
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
|
4
|
+
// Portions ©2008-2010 Apple Inc. All rights reserved.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*globals module test ok equals same CoreTest */
|
9
|
+
|
10
|
+
sc_require('debug/test_suites/array/base');
|
11
|
+
|
12
|
+
SC.ArraySuite.define(function(T) {
|
13
|
+
|
14
|
+
T.module("flatten");
|
15
|
+
|
16
|
+
test("should return flattened arrays", function() {
|
17
|
+
var expected = [1,2,3,4,'a'],
|
18
|
+
obj = T.newObject([1,2,[3,[4]],'a']);
|
19
|
+
|
20
|
+
expected.forEach(function(i,idx) {
|
21
|
+
equals(obj.flatten().objectAt(idx), i,'obj.flatten().objectAt(%@) should match %@'.fmt(idx,i));
|
22
|
+
});
|
23
|
+
});
|
24
|
+
});
|
@@ -11,7 +11,8 @@ SC.supplement(Array.prototype, SC.CoreArray);
|
|
11
11
|
|
12
12
|
// Because Arrays are dealt with so much, we add specialized functions.
|
13
13
|
|
14
|
-
SC.mixin(Array.prototype,
|
14
|
+
SC.mixin(Array.prototype,
|
15
|
+
/** @lends Array.prototype */ {
|
15
16
|
|
16
17
|
// primitive for array support.
|
17
18
|
replace: function(idx, amt, objects) {
|
@@ -142,7 +142,7 @@ SC.mixin(Function.prototype,
|
|
142
142
|
not cacheable.
|
143
143
|
|
144
144
|
@param {Boolean} aFlag optionally indicate cacheable or no, default YES
|
145
|
-
@returns {Function}
|
145
|
+
@returns {Function} receiver, useful for chaining calls.
|
146
146
|
*/
|
147
147
|
cacheable: function(aFlag) {
|
148
148
|
return SC.Function.cacheable(this, aFlag);
|
@@ -163,7 +163,7 @@ SC.mixin(Function.prototype,
|
|
163
163
|
non-volatile.
|
164
164
|
|
165
165
|
@param {Boolean} aFlag optionally indicate state, default to YES
|
166
|
-
@returns {Function}
|
166
|
+
@returns {Function} receiver, useful for chaining calls.
|
167
167
|
*/
|
168
168
|
idempotent: function(aFlag) {
|
169
169
|
return SC.Function.idempotent(this, aFlag);
|
@@ -174,13 +174,13 @@ SC.mixin(Function.prototype,
|
|
174
174
|
},
|
175
175
|
|
176
176
|
/**
|
177
|
-
Declare that a function should observe an object or property at the named
|
177
|
+
Declare that a function should observe an object or property at the named
|
178
178
|
path. Note that the path is used only to construct the observation one time.
|
179
179
|
|
180
180
|
@param {String...} propertyPaths A list of strings which indicate the
|
181
181
|
properties being observed
|
182
|
-
|
183
|
-
@returns {Function}
|
182
|
+
|
183
|
+
@returns {Function} receiver, useful for chaining calls.
|
184
184
|
*/
|
185
185
|
observes: function(propertyPaths) {
|
186
186
|
return SC.Function.observes(this, arguments);
|