sproutcore 1.5.0.pre.4 → 1.5.0.pre.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/VERSION.yml +1 -1
- data/lib/Buildfile +1 -1
- data/lib/buildtasks/build.rake +14 -6
- data/lib/buildtasks/manifest.rake +171 -72
- data/lib/frameworks/sproutcore/Buildfile +3 -5
- data/lib/frameworks/sproutcore/CHANGELOG.md +9 -0
- data/lib/frameworks/sproutcore/apps/test_controls/resources/main_page.js +2 -1
- data/lib/frameworks/sproutcore/apps/test_controls/resources/progress_page.js +7 -17
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +49 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +46 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +32 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +32 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +31 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +15 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +28 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +40 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +6 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +128 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +93 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +51 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/toolbar/method.js +33 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/toolbar/ui.js +29 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +9 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +148 -134
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +30 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +52 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +36 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +9 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +15 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +1 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/forms/views/form.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +25 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +64 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +34 -27
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +42 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +62 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +0 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +48 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +11 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +152 -74
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +12 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +1476 -176
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +227 -32
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +10 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +30 -8
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +4 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +4 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +4 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +4 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +4 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/slider.css +5 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/slider.js +11 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/well/well.css +7 -8
- data/lib/frameworks/sproutcore/themes/ace/resources/well/well.js +2 -4
- data/lib/gen/app/templates/apps/@target_name@/Buildfile +14 -0
- data/lib/gen/app/templates/apps/@target_name@/theme.js +27 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +4 -0
- data/lib/gen/project/templates/@filename@/Buildfile +7 -2
- data/lib/gen/theme/templates/themes/@target_name@/Buildfile +3 -0
- data/lib/gen/theme/templates/themes/@target_name@/theme.js +23 -0
- data/lib/sproutcore/builders.rb +2 -0
- data/lib/sproutcore/builders/chance.rb +64 -0
- data/lib/sproutcore/builders/chance_file.rb +59 -0
- data/lib/sproutcore/builders/combine.rb +0 -45
- data/lib/sproutcore/builders/html.rb +1 -1
- data/lib/sproutcore/builders/minify.rb +5 -17
- data/lib/sproutcore/builders/module.rb +2 -2
- data/lib/sproutcore/builders/string_wrapper.rb +13 -15
- data/lib/sproutcore/helpers.rb +1 -1
- data/lib/sproutcore/helpers/minifier.rb +56 -0
- data/lib/sproutcore/helpers/static_helper.rb +86 -40
- data/lib/sproutcore/models/generator.rb +16 -0
- data/lib/sproutcore/models/manifest_entry.rb +8 -1
- data/lib/sproutcore/models/target.rb +101 -33
- data/lib/sproutcore/tools.rb +0 -7
- data/lib/sproutcore/tools/build.rb +2 -37
- data/spec/buildtasks/manifest/prepare_build_tasks/chance_spec.rb +100 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +86 -9
- data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +1 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +1 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/module_info_spec.rb +96 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/module_spec.rb +83 -0
- data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +37 -4
- data/spec/buildtasks/manifest/spec_helper.rb +4 -0
- data/spec/fixtures/builder_tests/Buildfile +11 -9
- data/spec/fixtures/builder_tests/apps/chance_test/Buildfile +14 -0
- data/spec/fixtures/builder_tests/apps/chance_test/core.js +27 -0
- data/spec/fixtures/builder_tests/apps/chance_test/main.js +30 -0
- data/spec/fixtures/builder_tests/apps/chance_test/resources/demo.css +6 -0
- data/spec/fixtures/builder_tests/apps/chance_test/resources/last_file.css +7 -0
- data/spec/fixtures/builder_tests/apps/chance_test/resources/loading.rhtml +9 -0
- data/spec/fixtures/builder_tests/apps/chance_test/resources/main_page.js +24 -0
- data/spec/fixtures/builder_tests/apps/chance_test/resources/z_first_file.css +6 -0
- data/spec/fixtures/builder_tests/apps/chance_test/theme.js +27 -0
- data/spec/fixtures/builder_tests/apps/module_test/module.js +1 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/deferred_module/english.lproj/req_style_2.css +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/deferred_module/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/deferred_module/javascript.js +1 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/deferred_module/lib/alt_layout.rhtml +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/deferred_module/req_js_2.js +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/dynamic_req_target_1/dynamic_req_js_1.js +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/dynamic_req_target_1/english.lproj/dynamic_req_style_1.css +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/inlined_module/README +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_target/english.lproj/req_style_1.css +0 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_target/english.lproj/strings.js +4 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_target/english.lproj/test.rhtml +1 -0
- data/spec/fixtures/builder_tests/apps/module_test/modules/required_target/req_js_1.js +0 -0
- data/spec/fixtures/helper_tests/apps/minifier_test/core.js +8 -0
- data/spec/fixtures/real_world/Buildfile +11 -1
- data/spec/fixtures/real_world/apps/account/modules/preferences/README +0 -0
- data/spec/fixtures/real_world/apps/calendar/modules/preferences/README +0 -0
- data/spec/fixtures/real_world/apps/contacts/modules/preferences/README +0 -0
- data/spec/fixtures/real_world/apps/contacts/modules/printing/README +0 -0
- data/spec/fixtures/real_world/apps/mail/modules/preferences/README +0 -0
- data/spec/fixtures/real_world/apps/mail/modules/printing/README +0 -0
- data/spec/fixtures/real_world/apps/photos/modules/email/README +0 -0
- data/spec/fixtures/real_world/apps/photos/modules/preferences/README +0 -0
- data/spec/lib/builders/chance_file_spec.rb +63 -0
- data/spec/lib/builders/chance_spec.rb +81 -0
- data/spec/lib/builders/module_spec.rb +133 -0
- data/spec/lib/helpers/minifier.rb +31 -0
- data/spec/lib/models/project/find_targets_for_spec.rb +1 -1
- data/vendor/chance/lib/chance/imagers/data_url.rb +68 -17
- data/vendor/chance/lib/chance/instance.rb +55 -30
- data/vendor/chance/lib/chance/parser.rb +1 -1
- data/vendor/chance/lib/chance/slicing.rb +39 -3
- metadata +52 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +0 -163
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +0 -44
- data/spec/buildtasks/manifest/prepare_build_tasks/bundle_spec.rb +0 -254
- data/spec/fixtures/builder_tests/apps/bundle_test/bundle.js +0 -1
- data/spec/lib/builders/bundle_spec.rb +0 -295
@@ -37,6 +37,9 @@
|
|
37
37
|
isVerticalScrollerVisible: YES,
|
38
38
|
autohidesVerticalScroller: NO
|
39
39
|
|
40
|
+
})
|
41
|
+
.add("aria-controls_attribute", SC.ScrollView, {
|
42
|
+
contentView: iv
|
40
43
|
});
|
41
44
|
|
42
45
|
pane.show(); // add a test to show the test pane
|
@@ -146,5 +149,14 @@
|
|
146
149
|
equals(container.get('layer').scrollLeft, 10, 'scrollLeft should be readjusted to 10');
|
147
150
|
equals(container.get('layer').scrollTop, 10, 'scrollTop should be readjust to 10');
|
148
151
|
});
|
149
|
-
|
152
|
+
|
153
|
+
test('Scroller views of scroll view should have aria-controls set to its content', function() {
|
154
|
+
var view = pane.view("aria-controls_attribute"),
|
155
|
+
horizontalScrollerView = view.get('horizontalScrollerView'),
|
156
|
+
verticalScrollerView = view.get('verticalScrollerView'),
|
157
|
+
contentView = view.get('contentView');
|
158
|
+
|
159
|
+
equals(horizontalScrollerView.$().attr('aria-controls'), contentView, "horizontalScroller has aria-controls set");
|
160
|
+
equals(verticalScrollerView.$().attr('aria-controls'), contentView, "verticalScroller has aria-controls set");
|
161
|
+
});
|
150
162
|
})();
|
@@ -88,3 +88,31 @@ test('hasButtons', function() {
|
|
88
88
|
equals(view2.$('.endcap').length, 1, 'scrollers with buttons should have an endcap');
|
89
89
|
equals(view2.$('.button-bottom, .button-top').length, 0, 'scrollers with buttons should not have an up or a down button');
|
90
90
|
});
|
91
|
+
|
92
|
+
test('aria-role', function() {
|
93
|
+
var viewElem = view.$();
|
94
|
+
equals(viewElem.attr('role'), 'scrollbar', 'aria role set to the scroller');
|
95
|
+
});
|
96
|
+
|
97
|
+
test('aria-orientation', function(){
|
98
|
+
var viewElem = view.$();
|
99
|
+
equals(viewElem.attr('aria-orientation'), 'vertical', 'default aria-orientation should be vertical');
|
100
|
+
});
|
101
|
+
|
102
|
+
test('aria-valuemax', function(){
|
103
|
+
var viewElem = view1.$();
|
104
|
+
equals(viewElem.attr('aria-valuemax'), 100, 'aria-maximum attribute should be 100');
|
105
|
+
});
|
106
|
+
|
107
|
+
test('aria-valuemin', function(){
|
108
|
+
var viewElem = view1.$();
|
109
|
+
equals(viewElem.attr('aria-valuemin'), 10, 'aria-min attribute should be 10');
|
110
|
+
});
|
111
|
+
|
112
|
+
test('aria-valuenow', function(){
|
113
|
+
var viewElem;
|
114
|
+
view2.set('value', 80);
|
115
|
+
SC.RunLoop.begin().end();
|
116
|
+
viewElem = view2.$();
|
117
|
+
equals(viewElem.attr('aria-valuenow'), 80, 'aria-now attribute should be 10');
|
118
|
+
});
|
@@ -59,3 +59,50 @@ test("Check that properties are mapped correctly", function() {
|
|
59
59
|
equals(childViews[0].toolTip, null, 'Computed properties should match');
|
60
60
|
equals(childViews[0].index, 0, 'Computed properties should match');
|
61
61
|
});
|
62
|
+
|
63
|
+
|
64
|
+
test("Check that mouse actions work", function() {
|
65
|
+
view.triggerItemAtIndex(1);
|
66
|
+
SC.RunLoop.begin();
|
67
|
+
view.set('isEnabled', YES);
|
68
|
+
SC.RunLoop.end();
|
69
|
+
|
70
|
+
// Test Mouse Down
|
71
|
+
// it now gets the item by the position, so we have to pass a position
|
72
|
+
var firstItemEvent = SC.Event.simulateEvent(elem, 'mousedown', { clientX: rect1.left + 1, clientY: rect1.top + 1 });
|
73
|
+
view.mouseDown(firstItemEvent);
|
74
|
+
|
75
|
+
equals(view._isMouseDown, YES, 'Mouse down flag on mousedown should be ');
|
76
|
+
equals(view.get('activeIndex'), 0, 'The active item is the first segment.');
|
77
|
+
|
78
|
+
// Test Mouse Up
|
79
|
+
elem = view.get('layer').childNodes[1];
|
80
|
+
|
81
|
+
view.mouseUp(firstItemEvent);
|
82
|
+
equals(view._isMouseDown, NO, 'Mouse down flag on mouseup should be ');
|
83
|
+
equals(view.get('activeIndex'), -1, 'There shouldnt be any active item');
|
84
|
+
|
85
|
+
// Test third item
|
86
|
+
elem = view.get('layer').childNodes[2];
|
87
|
+
var thirdItemEvent = SC.Event.simulateEvent(elem, 'mousedown', { clientX: rect3.left + 1, client: rect3.top + 1 });
|
88
|
+
|
89
|
+
// mouse down and move
|
90
|
+
view.mouseDown(thirdItemEvent);
|
91
|
+
view.mouseMoved(thirdItemEvent);
|
92
|
+
equals(view._isMouseDown, YES, 'Mouse down flag on mousemoved should be ');
|
93
|
+
equals(view.get('activeIndex'), 2, 'The active item is the third segment.');
|
94
|
+
|
95
|
+
// try moving mouse while mouse down
|
96
|
+
var secondItemEvent = SC.Event.simulateEvent(elem, 'mousedown', { clientX: rect2.left + 1, clientY: rect2.top + 1 });
|
97
|
+
view.mouseMoved(secondItemEvent);
|
98
|
+
equals(view._isMouseDown, YES, 'Mouse down flag on mousemoved should be ');
|
99
|
+
equals(view.get('activeIndex'), 1, 'The active item should have changed to the second segment.');
|
100
|
+
|
101
|
+
// and check that mouse out cancels.
|
102
|
+
var noItemEvent = SC.Event.simulateEvent(elem, 'mousedown', { clientX: rect1.left - 5, clientY: rect1.top - 5 });
|
103
|
+
|
104
|
+
view.mouseExited(noItemEvent);
|
105
|
+
equals(view._isMouseDown, YES, 'Mouse down flag on mouseout should still be ');
|
106
|
+
equals(view.get('activeIndex'), -1, 'The active item is no longer specified.');
|
107
|
+
|
108
|
+
});
|
@@ -155,6 +155,25 @@ var pane;
|
|
155
155
|
itemWidthKey: 'width',
|
156
156
|
value: "D",
|
157
157
|
layout: { height: 25 }
|
158
|
+
})
|
159
|
+
.add("aria-role_tab,tablist", SC.SegmentedView, {
|
160
|
+
items: [
|
161
|
+
{title: "Item 1"},
|
162
|
+
{title: "Item 2"},
|
163
|
+
{title: "Item 3"}
|
164
|
+
],
|
165
|
+
itemTitleKey: "title",
|
166
|
+
layout: { height: 25 }
|
167
|
+
})
|
168
|
+
.add("aria-labelledby", SC.SegmentedView, {
|
169
|
+
items: [
|
170
|
+
{title: "Item 1", ariaLabeledBy: "item1"},
|
171
|
+
{title: "Item 2", ariaLabeledBy: "item2"},
|
172
|
+
{title: "Item 3", ariaLabeledBy: "item3"}
|
173
|
+
],
|
174
|
+
itemTitleKey: "title",
|
175
|
+
itemAriaLabeledByKey: "ariaLabeledBy",
|
176
|
+
layout: { height: 25 }
|
158
177
|
});
|
159
178
|
|
160
179
|
pane.show(); // add a test to show the test pane
|
@@ -180,6 +199,9 @@ var pane;
|
|
180
199
|
ok(pane.view('3_items,2_sel,emptySel,multiSel').get('isVisibleInWindow'), '3_items,2_sel,emptySel,multiSel.isVisibleInWindow should be YES');
|
181
200
|
ok(pane.view('3_items,leftAligned').get('isVisibleInWindow'), '3_items,leftAligned.isVisibleInWindow should be YES');
|
182
201
|
ok(pane.view('3_items,rightAligned').get('isVisibleInWindow'), '3_items,rightAligned.isVisibleInWindow should be YES');
|
202
|
+
ok(pane.view('aria-role_tab,tablist').get('isVisibleInWindow'), 'aria-role_tab,tablist.isVisibleInWindow should be YES');
|
203
|
+
ok(pane.view('aria-labelledby').get('isVisibleInWindow'), 'aria-labelledby.isVisibleInWindow should be YES');
|
204
|
+
|
183
205
|
});
|
184
206
|
|
185
207
|
|
@@ -395,4 +417,33 @@ var pane;
|
|
395
417
|
var overflowEl = segments[segments.length - 1];
|
396
418
|
ok($(overflowEl).hasClass('sel'), 'overflow segment should have .sel class');
|
397
419
|
});
|
420
|
+
|
421
|
+
test("Check that the segmented view and segments have aria roles set", function() {
|
422
|
+
var sv = pane.view("aria-role_tab,tablist"),
|
423
|
+
viewElem = sv.$(),
|
424
|
+
segments, i, len, segmentViewElem, role;
|
425
|
+
|
426
|
+
equals(viewElem.attr('role'), 'tablist', "The segmented view has aria role set");
|
427
|
+
|
428
|
+
segments = sv.get('childViews');
|
429
|
+
for( i = 0, len = segments.length; i<len; ++i) {
|
430
|
+
segmentViewElem = segments[i].$();
|
431
|
+
role = segmentViewElem.attr('role');
|
432
|
+
equals(role, "tab", "segment " + (i+1) + " have aria role set");
|
433
|
+
}
|
434
|
+
});
|
435
|
+
|
436
|
+
test("Check that the segments have aria-labelled attribute set", function() {
|
437
|
+
var sv = pane.view('aria-labelledby'),
|
438
|
+
segments = sv.get('childViews'),
|
439
|
+
i, len, segmentViewElem, ariaLabeledBy, aria_labelledby;
|
440
|
+
|
441
|
+
for(i = 0, len = segments.length; i<len; ++i) {
|
442
|
+
ariaLabeledBy = segments[i].get('ariaLabeledBy');
|
443
|
+
segmentViewElem = segments[i].$();
|
444
|
+
aria_labelledby = segmentViewElem.attr('aria-labelledby');
|
445
|
+
equals(aria_labelledby, ariaLabeledBy, "segment " + (i+1) + " has aria-labeledby set");
|
446
|
+
}
|
447
|
+
});
|
448
|
+
|
398
449
|
})();
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
|
4
|
+
// portions copyright @2009 Apple Inc.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*global module test htmlbody ok equals same stop start */
|
9
|
+
|
10
|
+
var pane, view;
|
11
|
+
module("SC.ToolbarView", {
|
12
|
+
setup: function() {
|
13
|
+
SC.RunLoop.begin();
|
14
|
+
pane = SC.MainPane.create({
|
15
|
+
childViews: [
|
16
|
+
SC.ToolbarView.extend({
|
17
|
+
layout: { left:12, height: 200, right:12, top:12 }
|
18
|
+
|
19
|
+
})]
|
20
|
+
});
|
21
|
+
pane.append(); // make sure there is a layer...
|
22
|
+
SC.RunLoop.end();
|
23
|
+
|
24
|
+
view = pane.childViews[0];
|
25
|
+
},
|
26
|
+
|
27
|
+
teardown: function() {
|
28
|
+
pane.remove();
|
29
|
+
pane = view = null ;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
|
4
|
+
// portions copyright @2009 Apple Inc.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
/*global module test htmlbody ok equals same stop start */
|
9
|
+
|
10
|
+
|
11
|
+
var pane;
|
12
|
+
(function() {
|
13
|
+
|
14
|
+
pane = SC.ControlTestPane.design()
|
15
|
+
|
16
|
+
.add("aria-role_ToolbarView", SC.ToolbarView, {
|
17
|
+
|
18
|
+
});
|
19
|
+
|
20
|
+
pane.show();
|
21
|
+
|
22
|
+
module('SC.ToolbarView UI', pane.standardSetup());
|
23
|
+
|
24
|
+
test("Check that the toolbar view has role set", function(){
|
25
|
+
var viewElem = pane.view('aria-role_ToolbarView').$();
|
26
|
+
|
27
|
+
equals(viewElem.attr('role'), 'toolbar', "toolbar view has correct role set");
|
28
|
+
});
|
29
|
+
})();
|
@@ -26,8 +26,36 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout, SC.Button,
|
|
26
26
|
|
27
27
|
classNames: ['sc-checkbox-view', 'sc-checkbox-control'],
|
28
28
|
tagName: 'label',
|
29
|
+
|
30
|
+
/**
|
31
|
+
The WAI-ARIA role of checkbox. This property's value should not be
|
32
|
+
changed.
|
33
|
+
|
34
|
+
@property {String}
|
35
|
+
*/
|
29
36
|
ariaRole: 'checkbox',
|
30
37
|
|
38
|
+
/**
|
39
|
+
The WAI-ARIA attribute for the checkbox. This property is assigned to
|
40
|
+
'aria-labelledby' attribute, which defines a string value that labels the
|
41
|
+
checkbox element. Used to support voiceover.It should be assigned a non-empty
|
42
|
+
string, if the 'aria-labelledby' attribute has to be set for the element.
|
43
|
+
|
44
|
+
@property {String}
|
45
|
+
*/
|
46
|
+
ariaLabeledBy: null,
|
47
|
+
|
48
|
+
/**
|
49
|
+
The WAI-ARIA attribute for the checkbox. This property is assigned to
|
50
|
+
'aria-label' attribute, which defines a string value that labels the
|
51
|
+
checkbox element. Used to support voiceover. It is used when it is not
|
52
|
+
possible to have a visible label on the screen. It should be assigned a non-empty
|
53
|
+
string, if the 'aria-label' attribute has to be set for the element.
|
54
|
+
|
55
|
+
@property {String}
|
56
|
+
*/
|
57
|
+
ariaLabel: null,
|
58
|
+
|
31
59
|
// no special theme for Checkbox; button defaults to 'square', so we have to stop that.
|
32
60
|
themeName: null,
|
33
61
|
renderDelegateName: 'checkboxRenderDelegate',
|
@@ -21,7 +21,15 @@ SC.DisclosureView = SC.ButtonView.extend(
|
|
21
21
|
/** @scope SC.DisclosureView.prototype */ {
|
22
22
|
|
23
23
|
classNames: ['sc-disclosure-view'],
|
24
|
-
|
24
|
+
|
25
|
+
/**
|
26
|
+
The WAI-ARIA attribute for the disclosure button. This property is assigned
|
27
|
+
to 'aria-label' attribute, which defines a string value that labels the
|
28
|
+
the element. Used to support voiceover. It is used when it is not
|
29
|
+
possible to have a visible label on the screen.
|
30
|
+
*/
|
31
|
+
ariaLabel: null,
|
32
|
+
|
25
33
|
renderDelegateName: 'disclosureRenderDelegate',
|
26
34
|
|
27
35
|
buttonBehavior: SC.TOGGLE_BEHAVIOR,
|
@@ -11,15 +11,15 @@ SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
|
|
11
11
|
|
12
12
|
/**
|
13
13
|
@class
|
14
|
-
|
14
|
+
|
15
15
|
Many times list items need to display a lot more than just a label of text.
|
16
|
-
You often need to include checkboxes, icons, right icons, extra counts and
|
17
|
-
an action or warning icon to the far right.
|
18
|
-
|
19
|
-
A ListItemView can implement all of this for you in a more efficient way
|
16
|
+
You often need to include checkboxes, icons, right icons, extra counts and
|
17
|
+
an action or warning icon to the far right.
|
18
|
+
|
19
|
+
A ListItemView can implement all of this for you in a more efficient way
|
20
20
|
than you might get if you simply put together a list item on your own using
|
21
21
|
views.
|
22
|
-
|
22
|
+
|
23
23
|
@extends SC.View
|
24
24
|
@extends SC.Control
|
25
25
|
@extends SC.Editable
|
@@ -29,30 +29,42 @@ SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
|
|
29
29
|
SC.ListItemView = SC.View.extend(
|
30
30
|
SC.Control,
|
31
31
|
/** @scope SC.ListItemView.prototype */ {
|
32
|
-
|
32
|
+
|
33
33
|
classNames: ['sc-list-item-view'],
|
34
|
-
|
34
|
+
|
35
35
|
displayProperties: ['disclosureState', 'escapeHTML'],
|
36
|
-
|
37
|
-
|
36
|
+
|
37
|
+
|
38
38
|
init: function() {
|
39
39
|
sc_super();
|
40
40
|
},
|
41
|
-
|
41
|
+
|
42
42
|
// ..........................................................
|
43
43
|
// KEY PROPERTIES
|
44
|
-
//
|
45
|
-
|
44
|
+
//
|
45
|
+
|
46
46
|
/**
|
47
47
|
The content object the list item will display.
|
48
|
-
|
48
|
+
|
49
49
|
@type SC.Object
|
50
50
|
*/
|
51
51
|
content: null,
|
52
|
-
|
52
|
+
|
53
|
+
/**
|
54
|
+
The index of the content object in the ListView to which this
|
55
|
+
ListItemView belongs.
|
56
|
+
|
57
|
+
For example, if this ListItemView represents the first object
|
58
|
+
in a ListView, this property would be 0.
|
59
|
+
|
60
|
+
@type Number
|
61
|
+
@isReadOnly
|
62
|
+
*/
|
63
|
+
contentIndex: null,
|
64
|
+
|
53
65
|
/**
|
54
66
|
(displayDelegate) True if you want the item view to display an icon.
|
55
|
-
|
67
|
+
|
56
68
|
If false, the icon on the list item view will be hidden. Otherwise,
|
57
69
|
space will be left for the icon next to the list item view.
|
58
70
|
*/
|
@@ -60,109 +72,109 @@ SC.ListItemView = SC.View.extend(
|
|
60
72
|
|
61
73
|
/**
|
62
74
|
(displayDelegate) True if you want the item view to display a right icon.
|
63
|
-
|
75
|
+
|
64
76
|
If false, the icon on the list item view will be hidden. Otherwise,
|
65
77
|
space will be left for the icon next to the list item view.
|
66
78
|
*/
|
67
79
|
hasContentRightIcon: NO,
|
68
|
-
|
80
|
+
|
69
81
|
/**
|
70
|
-
(displayDelegate) True if you want space to be allocated for a branch
|
82
|
+
(displayDelegate) True if you want space to be allocated for a branch
|
71
83
|
arrow.
|
72
|
-
|
84
|
+
|
73
85
|
If false, the space for the branch arrow will be collapsed.
|
74
86
|
*/
|
75
87
|
hasContentBranch: NO,
|
76
|
-
|
88
|
+
|
77
89
|
/**
|
78
90
|
(displayDelegate) The name of the property used for the checkbox value.
|
79
|
-
|
91
|
+
|
80
92
|
The checkbox will only be visible if this key is not null.
|
81
|
-
|
93
|
+
|
82
94
|
@type {String}
|
83
95
|
*/
|
84
96
|
contentCheckboxKey: null,
|
85
|
-
|
97
|
+
|
86
98
|
/**
|
87
99
|
The URL or CSS class name to use for the icon. This is only used if
|
88
100
|
contentIconKey is null, or returns null from the delegate.
|
89
101
|
*/
|
90
102
|
icon: null,
|
91
|
-
|
103
|
+
|
92
104
|
/**
|
93
105
|
(displayDelegate) Property key to use for the icon url
|
94
106
|
|
95
|
-
This property will be checked on the content object to determine the
|
107
|
+
This property will be checked on the content object to determine the
|
96
108
|
icon to display. It must return either a URL or a CSS class name.
|
97
109
|
*/
|
98
110
|
contentIconKey: null,
|
99
|
-
|
111
|
+
|
100
112
|
/**
|
101
113
|
The URL or CSS class name to use for the right icon. This is only used if
|
102
114
|
contentRightIconKey is null, or returns null from the delegate.
|
103
115
|
*/
|
104
116
|
rightIcon: null,
|
105
|
-
|
117
|
+
|
106
118
|
/**
|
107
119
|
(displayDelegate) Property key to use for the right icon url
|
108
120
|
|
109
|
-
This property will be checked on the content object to determine the
|
121
|
+
This property will be checked on the content object to determine the
|
110
122
|
icon to display. It must return either a URL or a CSS class name.
|
111
123
|
*/
|
112
124
|
contentRightIconKey: null,
|
113
|
-
|
125
|
+
|
114
126
|
/**
|
115
127
|
(displayDelegate) The name of the property used for label itself
|
116
|
-
|
128
|
+
|
117
129
|
If null, then the content object itself will be used..
|
118
130
|
*/
|
119
131
|
contentValueKey: null,
|
120
|
-
|
132
|
+
|
121
133
|
/**
|
122
134
|
IF true, the label value will be escaped to avoid HTML injection attacks.
|
123
|
-
You should only disable this option if you are sure you will only
|
124
|
-
display content that is already escaped and you need the added
|
135
|
+
You should only disable this option if you are sure you will only
|
136
|
+
display content that is already escaped and you need the added
|
125
137
|
performance gain.
|
126
138
|
*/
|
127
139
|
escapeHTML: YES,
|
128
|
-
|
140
|
+
|
129
141
|
/**
|
130
|
-
(displayDelegate) The name of the property used to find the count of
|
131
|
-
unread items.
|
132
|
-
|
133
|
-
The count will only be visible if this property is not null and the
|
142
|
+
(displayDelegate) The name of the property used to find the count of
|
143
|
+
unread items.
|
144
|
+
|
145
|
+
The count will only be visible if this property is not null and the
|
134
146
|
returned value is not 0.
|
135
147
|
*/
|
136
148
|
contentUnreadCountKey: null,
|
137
|
-
|
149
|
+
|
138
150
|
/**
|
139
151
|
(displayDelegate) The name of the property used to determine if the item
|
140
152
|
is a branch or leaf (i.e. if the branch icon should be displayed to the
|
141
153
|
right edge.)
|
142
|
-
|
154
|
+
|
143
155
|
If this is null, then the branch view will be completely hidden.
|
144
156
|
Otherwise space will be allocated for it.
|
145
157
|
*/
|
146
158
|
contentIsBranchKey: null,
|
147
|
-
|
159
|
+
|
148
160
|
|
149
161
|
/**
|
150
162
|
YES if the item view is currently editing.
|
151
163
|
*/
|
152
164
|
isEditing: NO,
|
153
|
-
|
165
|
+
|
154
166
|
/**
|
155
167
|
Indent to use when rendering a list item with an outline level > 0. The
|
156
|
-
left edge of the list item will be indented by this amount for each
|
168
|
+
left edge of the list item will be indented by this amount for each
|
157
169
|
outline level.
|
158
170
|
*/
|
159
171
|
outlineIndent: 16,
|
160
|
-
|
172
|
+
|
161
173
|
/**
|
162
174
|
Outline level for this list item. Usually set by the collection view.
|
163
175
|
*/
|
164
176
|
outlineLevel: 0,
|
165
|
-
|
177
|
+
|
166
178
|
/**
|
167
179
|
Disclosure state for this list item. Usually set by the collection view
|
168
180
|
when the list item is created.
|
@@ -180,10 +192,10 @@ SC.ListItemView = SC.View.extend(
|
|
180
192
|
if (this.get('contentIsEditable') !== this.contentIsEditable()) {
|
181
193
|
this.notifyPropertyChange('contentIsEditable');
|
182
194
|
}
|
183
|
-
|
195
|
+
|
184
196
|
this.displayDidChange();
|
185
197
|
},
|
186
|
-
|
198
|
+
|
187
199
|
/**
|
188
200
|
Determines if content is editable or not. Checkboxes and other related
|
189
201
|
components will render disabled if an item is not editable.
|
@@ -192,24 +204,24 @@ SC.ListItemView = SC.View.extend(
|
|
192
204
|
var content = this.get('content');
|
193
205
|
return content && (content.get ? content.get('isEditable')!==NO : NO);
|
194
206
|
}.property('content').cacheable(),
|
195
|
-
|
196
|
-
|
207
|
+
|
208
|
+
|
197
209
|
/**
|
198
210
|
Finds and retrieves the element containing the label. This is used
|
199
211
|
for inline editing. The default implementation returns a CoreQuery
|
200
|
-
selecting any label elements. If you override renderLabel() you
|
212
|
+
selecting any label elements. If you override renderLabel() you
|
201
213
|
probably need to override this as well.
|
202
|
-
|
214
|
+
|
203
215
|
@returns {SC.CoreQuery} CQ object selecting label elements
|
204
216
|
*/
|
205
217
|
$label: function() {
|
206
218
|
return this.$('label') ;
|
207
219
|
},
|
208
|
-
|
220
|
+
|
209
221
|
/**
|
210
|
-
Generates the html string used to represent the action item for your
|
222
|
+
Generates the html string used to represent the action item for your
|
211
223
|
list item. override this to return your own custom HTML
|
212
|
-
|
224
|
+
|
213
225
|
@param {SC.RenderContext} context the render context
|
214
226
|
@param {String} actionClassName the name of the action item
|
215
227
|
@returns {void}
|
@@ -217,15 +229,15 @@ SC.ListItemView = SC.View.extend(
|
|
217
229
|
renderAction: function(context, actionClassName){
|
218
230
|
context.push('<img src="',SC.BLANK_IMAGE_URL,'" class="action" />');
|
219
231
|
},
|
220
|
-
|
221
|
-
/**
|
232
|
+
|
233
|
+
/**
|
222
234
|
Determines if the event occured inside an element with the specified
|
223
235
|
classname or not.
|
224
236
|
*/
|
225
237
|
_isInsideElementWithClassName: function(className, evt) {
|
226
238
|
var layer = this.get('layer');
|
227
239
|
if (!layer) return NO ; // no layer yet -- nothing to do
|
228
|
-
|
240
|
+
|
229
241
|
var el = SC.$(evt.target) ;
|
230
242
|
var ret = NO, classNames ;
|
231
243
|
while(!ret && el.length>0 && (el[0] !== layer)) {
|
@@ -235,9 +247,9 @@ SC.ListItemView = SC.View.extend(
|
|
235
247
|
el = layer = null; //avoid memory leaks
|
236
248
|
return ret ;
|
237
249
|
},
|
238
|
-
|
250
|
+
|
239
251
|
/** @private
|
240
|
-
Returns YES if the list item has a checkbox and the event occurred
|
252
|
+
Returns YES if the list item has a checkbox and the event occurred
|
241
253
|
inside of it.
|
242
254
|
*/
|
243
255
|
_isInsideCheckbox: function(evt) {
|
@@ -245,18 +257,18 @@ SC.ListItemView = SC.View.extend(
|
|
245
257
|
var checkboxKey = this.getDelegateProperty('contentCheckboxKey', del) ;
|
246
258
|
return checkboxKey && this._isInsideElementWithClassName('sc-checkbox-view', evt);
|
247
259
|
},
|
248
|
-
|
249
|
-
/** @private
|
250
|
-
Returns YES if the list item has a disclosure triangle and the event
|
260
|
+
|
261
|
+
/** @private
|
262
|
+
Returns YES if the list item has a disclosure triangle and the event
|
251
263
|
occurred inside of it.
|
252
264
|
*/
|
253
265
|
_isInsideDisclosure: function(evt) {
|
254
266
|
if (this.get('disclosureState')===SC.LEAF_NODE) return NO;
|
255
267
|
return this._isInsideElementWithClassName('sc-disclosure-view', evt);
|
256
268
|
},
|
257
|
-
|
258
|
-
/** @private
|
259
|
-
Returns YES if the list item has a right icon and the event
|
269
|
+
|
270
|
+
/** @private
|
271
|
+
Returns YES if the list item has a right icon and the event
|
260
272
|
occurred inside of it.
|
261
273
|
*/
|
262
274
|
_isInsideRightIcon: function(evt) {
|
@@ -264,17 +276,17 @@ SC.ListItemView = SC.View.extend(
|
|
264
276
|
var rightIconKey = this.getDelegateProperty('hasContentRightIcon', del) || !SC.none(this.rightIcon);
|
265
277
|
return rightIconKey && this._isInsideElementWithClassName('right-icon', evt);
|
266
278
|
},
|
267
|
-
|
268
|
-
/** @private
|
279
|
+
|
280
|
+
/** @private
|
269
281
|
mouseDown is handled only for clicks on the checkbox view or or action
|
270
282
|
button.
|
271
283
|
*/
|
272
284
|
mouseDown: function(evt) {
|
273
|
-
|
285
|
+
|
274
286
|
// if content is not editable, then always let collection view handle the
|
275
287
|
// event.
|
276
|
-
if (!this.get('contentIsEditable')) return NO ;
|
277
|
-
|
288
|
+
if (!this.get('contentIsEditable')) return NO ;
|
289
|
+
|
278
290
|
// if occurred inside checkbox, item view should handle the event.
|
279
291
|
if (this._isInsideCheckbox(evt)) {
|
280
292
|
this._addCheckboxActiveState() ;
|
@@ -293,17 +305,17 @@ SC.ListItemView = SC.View.extend(
|
|
293
305
|
this._isMouseInsideRightIcon = YES ;
|
294
306
|
return YES;
|
295
307
|
}
|
296
|
-
|
308
|
+
|
297
309
|
return NO ; // let the collection view handle this event
|
298
310
|
},
|
299
|
-
|
311
|
+
|
300
312
|
mouseUp: function(evt) {
|
301
313
|
var ret= NO, del, checkboxKey, content, state, idx, set;
|
302
314
|
|
303
|
-
// if mouse was down in checkbox -- then handle mouse up, otherwise
|
315
|
+
// if mouse was down in checkbox -- then handle mouse up, otherwise
|
304
316
|
// allow parent view to handle event.
|
305
317
|
if (this._isMouseDownOnCheckbox) {
|
306
|
-
|
318
|
+
|
307
319
|
// update only if mouse inside on mouse up...
|
308
320
|
if (this._isInsideCheckbox(evt)) {
|
309
321
|
del = this.displayDelegate ;
|
@@ -316,10 +328,10 @@ SC.ListItemView = SC.View.extend(
|
|
316
328
|
this.displayDidChange(); // repaint view...
|
317
329
|
}
|
318
330
|
}
|
319
|
-
|
331
|
+
|
320
332
|
this._removeCheckboxActiveState() ;
|
321
333
|
ret = YES ;
|
322
|
-
|
334
|
+
|
323
335
|
// if mouse as down on disclosure -- handle mosue up. otherwise pass on
|
324
336
|
// to parent.
|
325
337
|
} else if (this._isMouseDownOnDisclosure) {
|
@@ -328,35 +340,35 @@ SC.ListItemView = SC.View.extend(
|
|
328
340
|
idx = this.get('contentIndex');
|
329
341
|
set = (!SC.none(idx)) ? SC.IndexSet.create(idx) : null;
|
330
342
|
del = this.get('displayDelegate');
|
331
|
-
|
343
|
+
|
332
344
|
if (state === SC.BRANCH_OPEN) {
|
333
345
|
if (set && del && del.collapse) del.collapse(set);
|
334
346
|
else this.set('disclosureState', SC.BRANCH_CLOSED);
|
335
347
|
this.displayDidChange();
|
336
|
-
|
348
|
+
|
337
349
|
} else if (state === SC.BRANCH_CLOSED) {
|
338
350
|
if (set && del && del.expand) del.expand(set);
|
339
351
|
else this.set('disclosureState', SC.BRANCH_OPEN);
|
340
352
|
this.displayDidChange();
|
341
353
|
}
|
342
354
|
}
|
343
|
-
|
355
|
+
|
344
356
|
this._removeDisclosureActiveState();
|
345
357
|
ret = YES ;
|
346
|
-
// if mouse was down in right icon -- then handle mouse up, otherwise
|
358
|
+
// if mouse was down in right icon -- then handle mouse up, otherwise
|
347
359
|
// allow parent view to handle event.
|
348
360
|
} else if (this._isMouseDownOnRightIcon) {
|
349
361
|
this._removeRightIconActiveState() ;
|
350
362
|
ret = YES ;
|
351
|
-
}
|
352
|
-
|
363
|
+
}
|
364
|
+
|
353
365
|
// clear cached info
|
354
366
|
this._isMouseInsideCheckbox = this._isMouseDownOnCheckbox = NO ;
|
355
367
|
this._isMouseDownOnDisclosure = this._isMouseInsideDisclosure = NO ;
|
356
368
|
this._isMouseInsideRightIcon = this._isMouseDownOnRightIcon = NO ;
|
357
369
|
return ret ;
|
358
370
|
},
|
359
|
-
|
371
|
+
|
360
372
|
mouseMoved: function(evt) {
|
361
373
|
if (this._isMouseDownOnCheckbox && this._isInsideCheckbox(evt)) {
|
362
374
|
this._addCheckboxActiveState() ;
|
@@ -379,31 +391,31 @@ SC.ListItemView = SC.View.extend(
|
|
379
391
|
}
|
380
392
|
return NO ;
|
381
393
|
},
|
382
|
-
|
394
|
+
|
383
395
|
touchStart: function(evt){
|
384
396
|
return this.mouseDown(evt);
|
385
397
|
},
|
386
|
-
|
398
|
+
|
387
399
|
touchEnd: function(evt){
|
388
400
|
return this.mouseUp(evt);
|
389
401
|
},
|
390
|
-
|
402
|
+
|
391
403
|
touchEntered: function(evt){
|
392
404
|
return this.mouseEntered(evt);
|
393
405
|
},
|
394
|
-
|
406
|
+
|
395
407
|
touchExited: function(evt){
|
396
408
|
return this.mouseExited(evt);
|
397
409
|
},
|
398
|
-
|
399
|
-
|
410
|
+
|
411
|
+
|
400
412
|
_addCheckboxActiveState: function() {
|
401
413
|
if (this.get('isEnabled')) {
|
402
414
|
if (this._checkboxRenderDelegate) {
|
403
415
|
var source = this._checkboxRenderSource;
|
404
416
|
|
405
417
|
source.set('isActive', YES);
|
406
|
-
|
418
|
+
|
407
419
|
this._checkboxRenderDelegate.update(source, this.$('.sc-checkbox-view'));
|
408
420
|
} else {
|
409
421
|
// for backwards-compatibility.
|
@@ -411,13 +423,13 @@ SC.ListItemView = SC.View.extend(
|
|
411
423
|
}
|
412
424
|
}
|
413
425
|
},
|
414
|
-
|
426
|
+
|
415
427
|
_removeCheckboxActiveState: function() {
|
416
428
|
if (this._checkboxRenderer) {
|
417
429
|
var source = this._checkboxRenderSource;
|
418
430
|
|
419
431
|
source.set('isActive', NO);
|
420
|
-
|
432
|
+
|
421
433
|
this._checkboxRenderDelegate.update(source, this.$('.sc-checkbox-view'));
|
422
434
|
} else {
|
423
435
|
// for backwards-compatibility.
|
@@ -430,7 +442,7 @@ SC.ListItemView = SC.View.extend(
|
|
430
442
|
if (this._disclosureRenderDelegate) {
|
431
443
|
var source = this._disclosureRenderSource;
|
432
444
|
source.set('isActive', YES);
|
433
|
-
|
445
|
+
|
434
446
|
this._disclosureRenderDelegate.update(source, this.$('.sc-disclosure-view'));
|
435
447
|
} else {
|
436
448
|
// for backwards-compatibility.
|
@@ -439,12 +451,12 @@ SC.ListItemView = SC.View.extend(
|
|
439
451
|
|
440
452
|
}
|
441
453
|
},
|
442
|
-
|
454
|
+
|
443
455
|
_removeDisclosureActiveState: function() {
|
444
456
|
if (this._disclosureRenderer) {
|
445
457
|
var source = this._disclosureRenderSource;
|
446
458
|
source.set('isActive', NO);
|
447
|
-
|
459
|
+
|
448
460
|
this._disclosureRenderDelegate.update(source, this.$('.sc-disclosure-view'));
|
449
461
|
} else {
|
450
462
|
// for backwards-compatibility.
|
@@ -455,18 +467,18 @@ SC.ListItemView = SC.View.extend(
|
|
455
467
|
_addRightIconActiveState: function() {
|
456
468
|
this.$('img.right-icon').setClass('active', YES);
|
457
469
|
},
|
458
|
-
|
470
|
+
|
459
471
|
_removeRightIconActiveState: function() {
|
460
472
|
this.$('img.right-icon').removeClass('active');
|
461
473
|
},
|
462
|
-
|
474
|
+
|
463
475
|
/**
|
464
476
|
Returns true if a click is on the label text itself to enable editing.
|
465
|
-
|
466
|
-
Note that if you override renderLabel(), you probably need to override
|
477
|
+
|
478
|
+
Note that if you override renderLabel(), you probably need to override
|
467
479
|
this as well, or just $label() if you only want to control the element
|
468
480
|
returned.
|
469
|
-
|
481
|
+
|
470
482
|
@param evt {Event} the mouseUp event.
|
471
483
|
@returns {Boolean} YES if the mouse was on the content element itself.
|
472
484
|
*/
|
@@ -475,26 +487,26 @@ SC.ListItemView = SC.View.extend(
|
|
475
487
|
var del = this.displayDelegate ;
|
476
488
|
var labelKey = this.getDelegateProperty('contentValueKey', del) ;
|
477
489
|
if (!labelKey) return NO ;
|
478
|
-
|
490
|
+
|
479
491
|
// get the element to check for.
|
480
492
|
var el = this.$label()[0] ;
|
481
493
|
if (!el) return NO ; // no label to check for.
|
482
|
-
|
494
|
+
|
483
495
|
var cur = evt.target, layer = this.get('layer') ;
|
484
496
|
while(cur && (cur !== layer) && (cur !== window)) {
|
485
497
|
if (cur === el) return YES ;
|
486
498
|
cur = cur.parentNode ;
|
487
499
|
}
|
488
|
-
|
500
|
+
|
489
501
|
return NO;
|
490
502
|
},
|
491
|
-
|
503
|
+
|
492
504
|
beginEditing: function() {
|
493
505
|
if (this.get('isEditing')) return YES ;
|
494
506
|
//if (!this.get('contentIsEditable')) return NO ;
|
495
507
|
return this._beginEditing(YES);
|
496
508
|
},
|
497
|
-
|
509
|
+
|
498
510
|
_beginEditing: function(scrollIfNeeded) {
|
499
511
|
var content = this.get('content'),
|
500
512
|
del = this.get('displayDelegate'),
|
@@ -518,8 +530,8 @@ SC.ListItemView = SC.View.extend(
|
|
518
530
|
});
|
519
531
|
return YES; // let the scroll happen then begin editing...
|
520
532
|
}
|
521
|
-
|
522
|
-
// nothing to do...
|
533
|
+
|
534
|
+
// nothing to do...
|
523
535
|
if (!parent || !el || el.get('length')===0) return NO ;
|
524
536
|
v = (labelKey && content && content.get) ? content.get(labelKey) : null ;
|
525
537
|
|
@@ -542,7 +554,7 @@ SC.ListItemView = SC.View.extend(
|
|
542
554
|
targetLineHeight = fontSize * 1.5 ;
|
543
555
|
if (targetLineHeight < lineHeight) {
|
544
556
|
el.css({ lineHeight: '1.5' });
|
545
|
-
lineHeightShift = (lineHeight - targetLineHeight) / 2;
|
557
|
+
lineHeightShift = (lineHeight - targetLineHeight) / 2;
|
546
558
|
} else oldLineHeight = null ;
|
547
559
|
}
|
548
560
|
|
@@ -554,50 +566,52 @@ SC.ListItemView = SC.View.extend(
|
|
554
566
|
escapeHTML = this.get('escapeHTML');
|
555
567
|
|
556
568
|
ret = SC.InlineTextFieldView.beginEditing({
|
557
|
-
frame: f,
|
558
|
-
exampleElement: el,
|
559
|
-
delegate: this,
|
569
|
+
frame: f,
|
570
|
+
exampleElement: el,
|
571
|
+
delegate: this,
|
560
572
|
value: v,
|
561
573
|
multiline: NO,
|
562
574
|
isCollection: YES,
|
563
575
|
validator: validator,
|
564
|
-
escapeHTML: escapeHTML
|
576
|
+
escapeHTML: escapeHTML,
|
577
|
+
pane: this.get('pane'),
|
578
|
+
layout: this.get('layout')
|
565
579
|
}) ;
|
566
580
|
|
567
|
-
// restore old line height for original item if the old line height
|
581
|
+
// restore old line height for original item if the old line height
|
568
582
|
// was saved.
|
569
583
|
if (oldLineHeight) el.css({ lineHeight: oldLineHeight }) ;
|
570
584
|
|
571
585
|
// Done! If this failed, then set editing back to no.
|
572
586
|
return ret ;
|
573
587
|
},
|
574
|
-
|
588
|
+
|
575
589
|
commitEditing: function() {
|
576
590
|
if (!this.get('isEditing')) return YES ;
|
577
591
|
return SC.InlineTextFieldView.commitEditing();
|
578
592
|
},
|
579
|
-
|
593
|
+
|
580
594
|
discardEditing: function() {
|
581
595
|
if (!this.get('isEditing')) return YES ;
|
582
596
|
return SC.InlineTextFieldView.discardEditing();
|
583
597
|
},
|
584
|
-
|
585
|
-
|
598
|
+
|
599
|
+
|
586
600
|
/** @private
|
587
601
|
Allow editing.
|
588
602
|
*/
|
589
603
|
inlineEditorShouldBeginEditing: function(inlineEditor) {
|
590
604
|
return YES ;
|
591
605
|
},
|
592
|
-
|
606
|
+
|
593
607
|
/** @private
|
594
608
|
Set editing to true so edits will no longer be allowed.
|
595
609
|
*/
|
596
610
|
inlineEditorWillBeginEditing: function(inlineEditor) {
|
597
611
|
this.set('isEditing', YES);
|
598
612
|
},
|
599
|
-
|
600
|
-
/** @private
|
613
|
+
|
614
|
+
/** @private
|
601
615
|
Hide the label view while the inline editor covers it.
|
602
616
|
*/
|
603
617
|
inlineEditorDidBeginEditing: function(inlineEditor) {
|
@@ -609,13 +623,13 @@ SC.ListItemView = SC.View.extend(
|
|
609
623
|
inlineEditorShouldEndEditing: function(inlineEditor, finalValue) {
|
610
624
|
return YES ;
|
611
625
|
},
|
612
|
-
|
626
|
+
|
613
627
|
/** @private
|
614
628
|
Update the field value and make it visible again.
|
615
629
|
*/
|
616
630
|
inlineEditorDidEndEditing: function(inlineEditor, finalValue) {
|
617
631
|
this.set('isEditing', NO) ;
|
618
|
-
|
632
|
+
|
619
633
|
var content = this.get('content') ;
|
620
634
|
var del = this.displayDelegate ;
|
621
635
|
var labelKey = this.getDelegateProperty('contentValueKey', del) ;
|
@@ -747,20 +761,20 @@ SC.ListItemView = SC.View.extend(
|
|
747
761
|
.addClass('sc-regular-size')
|
748
762
|
.addClass(this.get('theme').classNames)
|
749
763
|
.addClass(renderer.get('name'));
|
750
|
-
|
764
|
+
|
751
765
|
var source = this._disclosureRenderSource;
|
752
766
|
if (!source) {
|
753
|
-
this._disclosureRenderSource = source =
|
767
|
+
this._disclosureRenderSource = source =
|
754
768
|
SC.Object.create({ renderState: {}, theme: this.get('theme') });
|
755
769
|
}
|
756
|
-
|
770
|
+
|
757
771
|
source
|
758
772
|
.set('isSelected', state === SC.BRANCH_OPEN)
|
759
773
|
.set('isEnabled', this.get('isEnabled'))
|
760
774
|
.set('title', '');
|
761
|
-
|
775
|
+
|
762
776
|
renderer.render(source, context);
|
763
|
-
|
777
|
+
|
764
778
|
context = context.end();
|
765
779
|
this._disclosureRenderDelegate = renderer;
|
766
780
|
},
|
@@ -784,22 +798,22 @@ SC.ListItemView = SC.View.extend(
|
|
784
798
|
.addClass('sc-regular-size')
|
785
799
|
.addClass(this.get('theme').classNames)
|
786
800
|
.addClass(renderer.get('name'));
|
787
|
-
|
801
|
+
|
788
802
|
var source = this._checkboxRenderSource;
|
789
803
|
if (!source) {
|
790
|
-
source = this._checkboxRenderSource =
|
804
|
+
source = this._checkboxRenderSource =
|
791
805
|
SC.Object.create({ renderState: {}, theme: this.get('theme') });
|
792
806
|
}
|
793
|
-
|
807
|
+
|
794
808
|
source
|
795
809
|
.set('isSelected', state && (state !== SC.MIXED_STATE))
|
796
810
|
.set('isEnabled', this.get('isEnabled') && this.get('contentIsEditable'))
|
797
811
|
.set('isActive', this._checkboxIsActive)
|
798
812
|
.set('title', '');
|
799
|
-
|
813
|
+
|
800
814
|
renderer.render(source, context);
|
801
815
|
context = context.end();
|
802
|
-
|
816
|
+
|
803
817
|
this._checkboxRenderDelegate = renderer;
|
804
818
|
},
|
805
819
|
|
@@ -909,7 +923,7 @@ SC.ListItemView = SC.View.extend(
|
|
909
923
|
.push(' ')
|
910
924
|
.end();
|
911
925
|
}
|
912
|
-
|
926
|
+
|
913
927
|
});
|
914
928
|
|
915
929
|
SC.ListItemView._deprecatedRenderWarningHasBeenIssued = false;
|