sproutcore 1.10.0 → 1.10.1
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.
- checksums.yaml +8 -8
- data/VERSION.yml +1 -1
- data/bin/sc-phantom +13 -0
- data/lib/Buildfile +3 -0
- data/lib/buildtasks/manifest.rake +3 -0
- data/lib/frameworks/sproutcore/CHANGELOG.md +24 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/high_light.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/page_item_view.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +4 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +44 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +167 -91
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/touch.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +7 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +26 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +9 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +25 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +29 -29
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +107 -106
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +120 -134
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +197 -196
- data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +22 -10
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +90 -79
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/advanced/event_queuing.js +104 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/handlebars.js +2 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/grid.css +17 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +1 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/panel/panel.css +2 -2
- data/lib/frameworks/sproutcore/themes/empty_theme/theme.js +1 -1
- data/lib/sproutcore/tools.rb +2 -1
- data/lib/sproutcore/tools/phantom.rb +36 -0
- data/sproutcore.gemspec +1 -1
- data/vendor/chance/lib/chance/instance.rb +5 -2
- metadata +11 -4
@@ -0,0 +1,215 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
4
|
+
// portions copyright @2011 Apple Inc.
|
5
|
+
// License: Licensed under MIT license (see license.js)
|
6
|
+
// ==========================================================================
|
7
|
+
|
8
|
+
var view, content, contentController, pane, actionCalled = 0;
|
9
|
+
|
10
|
+
module("SC.CollectionView Touch Events", {
|
11
|
+
setup: function() {
|
12
|
+
|
13
|
+
SC.platform.simulateTouchEvents();
|
14
|
+
|
15
|
+
SC.RunLoop.begin();
|
16
|
+
|
17
|
+
content = "1 2 3 4 5 6 7 8 9 10".w().map(function(x) {
|
18
|
+
return SC.Object.create({ value: x });
|
19
|
+
});
|
20
|
+
|
21
|
+
contentController = SC.ArrayController.create({
|
22
|
+
content: content,
|
23
|
+
allowsMultipleSelection: YES
|
24
|
+
});
|
25
|
+
|
26
|
+
view = SC.CollectionView.create({
|
27
|
+
content: contentController,
|
28
|
+
|
29
|
+
layout: { top: 0, left: 0, width: 300, height: 500 },
|
30
|
+
|
31
|
+
layoutForContentIndex: function(idx) {
|
32
|
+
return { left: 0, right: 0, top: idx * 50, height: 50 };
|
33
|
+
},
|
34
|
+
|
35
|
+
isVisibleInWindow: YES,
|
36
|
+
acceptsFirstResponder: YES,
|
37
|
+
action: function() {
|
38
|
+
actionCalled++;
|
39
|
+
}
|
40
|
+
});
|
41
|
+
|
42
|
+
pane = SC.MainPane.create();
|
43
|
+
pane.appendChild(view);
|
44
|
+
pane.append();
|
45
|
+
|
46
|
+
SC.RunLoop.end();
|
47
|
+
},
|
48
|
+
|
49
|
+
teardown: function() {
|
50
|
+
SC.RunLoop.begin();
|
51
|
+
pane.remove();
|
52
|
+
actionCalled = 0;
|
53
|
+
SC.RunLoop.end();
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
/*
|
58
|
+
Simulates touching the specified index. If you pass verify as YES or NO
|
59
|
+
also verifies that the item view is subsequently selected or not.
|
60
|
+
|
61
|
+
@param {SC.CollectionView} view the view
|
62
|
+
@param {Number} index the index to touch on
|
63
|
+
@param {SC.SelectionSet} expected expected selection
|
64
|
+
@param {Number} delay delay before running the test (optional)
|
65
|
+
@returns {void}
|
66
|
+
*/
|
67
|
+
function touchOn(view, index, expected, delay) {
|
68
|
+
var itemView = view.itemViewForContentIndex(index),
|
69
|
+
layer = itemView.get('layer'),
|
70
|
+
opts = {},
|
71
|
+
sel, ev, modifiers;
|
72
|
+
|
73
|
+
ok(layer, 'precond - itemView[%@] should have layer'.fmt(index));
|
74
|
+
|
75
|
+
ev = SC.Event.simulateEvent(layer, 'mousedown', opts);
|
76
|
+
SC.Event.trigger(layer, 'mousedown', [ev]);
|
77
|
+
|
78
|
+
ev = SC.Event.simulateEvent(layer, 'mouseup', opts);
|
79
|
+
SC.Event.trigger(layer, 'mouseup', [ev]);
|
80
|
+
|
81
|
+
if (expected !== undefined) {
|
82
|
+
var f = function() {
|
83
|
+
SC.RunLoop.begin();
|
84
|
+
sel = view.get('selection');
|
85
|
+
|
86
|
+
ok(expected ? expected.isEqual(sel) : expected === sel, 'should have selection: %@ after touch on item[%@], actual: %@'.fmt(expected, index, sel));
|
87
|
+
SC.RunLoop.end();
|
88
|
+
if (delay) window.start() ; // starts the test runner
|
89
|
+
};
|
90
|
+
|
91
|
+
if (delay) {
|
92
|
+
stop() ; // stops the test runner
|
93
|
+
setTimeout(f, delay) ;
|
94
|
+
} else f() ;
|
95
|
+
}
|
96
|
+
|
97
|
+
layer = itemView = null ;
|
98
|
+
}
|
99
|
+
|
100
|
+
/*
|
101
|
+
Creates an SC.SelectionSet from a given index.
|
102
|
+
|
103
|
+
@param {Number} index the index of the content to select
|
104
|
+
@returns {SC.SelectionSet}
|
105
|
+
*/
|
106
|
+
|
107
|
+
function selectionFromIndex(index) {
|
108
|
+
var ret = SC.SelectionSet.create();
|
109
|
+
ret.addObject(content.objectAt(index));
|
110
|
+
|
111
|
+
return ret;
|
112
|
+
}
|
113
|
+
|
114
|
+
/*
|
115
|
+
Creates an SC.SelectionSet from a given SC.IndexSet.
|
116
|
+
|
117
|
+
@param {Number} index the index of the content to select
|
118
|
+
@returns {SC.SelectionSet}
|
119
|
+
*/
|
120
|
+
function selectionFromIndexSet(indexSet) {
|
121
|
+
var ret = SC.SelectionSet.create();
|
122
|
+
ret.add(content, indexSet);
|
123
|
+
|
124
|
+
return ret;
|
125
|
+
}
|
126
|
+
|
127
|
+
// ..........................................................
|
128
|
+
// basic touch
|
129
|
+
//
|
130
|
+
|
131
|
+
test("touching an item should select it", function() {
|
132
|
+
touchOn(view, 3, selectionFromIndex(3));
|
133
|
+
});
|
134
|
+
|
135
|
+
test("touching a selected item should maintain it selected", function() {
|
136
|
+
view.select(SC.IndexSet.create(1,3));
|
137
|
+
touchOn(view, 3, selectionFromIndex(3));
|
138
|
+
});
|
139
|
+
|
140
|
+
test("touching two times on an item should select it", function() {
|
141
|
+
touchOn(view, 3);
|
142
|
+
touchOn(view, 3);
|
143
|
+
itemView = view.itemViewForContentIndex(3);
|
144
|
+
equals(itemView.get('isSelected'), YES, 'itemView.isSelected should remain YES after touched two times');
|
145
|
+
});
|
146
|
+
|
147
|
+
test("touching unselected item should clear selection and select it", function() {
|
148
|
+
view.select(SC.IndexSet.create(1,5));
|
149
|
+
touchOn(view, 7, selectionFromIndex(7));
|
150
|
+
});
|
151
|
+
|
152
|
+
test("first responder", function() {
|
153
|
+
touchOn(view, 3);
|
154
|
+
equals(view.get('isFirstResponder'), YES, 'view.isFirstResponder should be YES after touch start');
|
155
|
+
});
|
156
|
+
|
157
|
+
test("touching a collection view with null content should not throw an error", function() {
|
158
|
+
var failed = NO;
|
159
|
+
view.set('content', null);
|
160
|
+
try {
|
161
|
+
var l = view.get('layer'),
|
162
|
+
evt = SC.Event.simulateEvent(l, 'mousedown');
|
163
|
+
SC.Event.trigger(l, 'mousedown', [evt]);
|
164
|
+
}
|
165
|
+
catch (e) { failed = YES; }
|
166
|
+
ok(!failed, "touching a collection view with null content should not throw an error");
|
167
|
+
});
|
168
|
+
|
169
|
+
test("touching an item should select it when useToggleSelection is true", function() {
|
170
|
+
view.set('useToggleSelection', YES);
|
171
|
+
touchOn(view, 3, selectionFromIndex(3));
|
172
|
+
});
|
173
|
+
|
174
|
+
test("touching an unselected item should select it when useToggleSelection is true", function() {
|
175
|
+
view.set('useToggleSelection', YES);
|
176
|
+
touchOn(view, 3, selectionFromIndex(3));
|
177
|
+
});
|
178
|
+
|
179
|
+
test("touching a selected item should deselect it when useToggleSelection is true", function() {
|
180
|
+
view.set('useToggleSelection', YES);
|
181
|
+
view.select(SC.IndexSet.create(3,1));
|
182
|
+
touchOn(view, 3, SC.SelectionSet.create());
|
183
|
+
});
|
184
|
+
|
185
|
+
test("touching a selected item should remove it from the selection when useToggleSelection is true", function() {
|
186
|
+
view.set('useToggleSelection', YES);
|
187
|
+
view.select(SC.IndexSet.create(1,5));
|
188
|
+
touchOn(view, 5, selectionFromIndexSet(SC.IndexSet.create(1,4)));
|
189
|
+
});
|
190
|
+
|
191
|
+
test("touching an unselected item should select it and clear the previous selection when useToggleSelection is true and allowsMultipleSelection is not", function() {
|
192
|
+
view.set('useToggleSelection', YES);
|
193
|
+
contentController.set('allowsMultipleSelection', NO);
|
194
|
+
touchOn(view, 1, selectionFromIndex(1));
|
195
|
+
touchOn(view, 3, selectionFromIndex(3));
|
196
|
+
});
|
197
|
+
|
198
|
+
test("touching an unselected item should fire action when useToggleSelection is true and actOnSelect is true", function() {
|
199
|
+
view.set('useToggleSelection', YES);
|
200
|
+
view.set('actOnSelect', YES);
|
201
|
+
|
202
|
+
equals(actionCalled, 0, "precond - action hasn't been called");
|
203
|
+
touchOn(view, 1);
|
204
|
+
equals(actionCalled, 1, "Action called when item is selected");
|
205
|
+
});
|
206
|
+
|
207
|
+
test("touching an item when isSelectable is false doesn't do anything", function() {
|
208
|
+
view.set('isSelectable', NO);
|
209
|
+
touchOn(view, 1, null);
|
210
|
+
});
|
211
|
+
|
212
|
+
test("touching an item when isEnabled is false doesn't do anything", function() {
|
213
|
+
view.set('isEnabled', NO);
|
214
|
+
touchOn(view, 1, null);
|
215
|
+
});
|
@@ -44,7 +44,12 @@ var pane = SC.ControlTestPane.design()
|
|
44
44
|
contentValueKey: "title",
|
45
45
|
contentCheckboxKey: "isDone",
|
46
46
|
contentUnreadCountKey: "unread",
|
47
|
-
rowHeight: 20
|
47
|
+
rowHeight: 20,
|
48
|
+
_didCallDragEnded: false,
|
49
|
+
dragEnded: function() {
|
50
|
+
sc_super();
|
51
|
+
this._didCallDragEnded = true;
|
52
|
+
}
|
48
53
|
})
|
49
54
|
}));
|
50
55
|
|
@@ -200,7 +205,6 @@ test("insertion point when cancel drag on grid view", function() {
|
|
200
205
|
layer,
|
201
206
|
gridView = pane.view("basic").get('contentView');
|
202
207
|
|
203
|
-
// Configure the view to accept drop on.
|
204
208
|
gridView.set('canReorderContent', YES);
|
205
209
|
|
206
210
|
itemView = gridView.itemViewForContentIndex(0);
|
@@ -233,6 +237,7 @@ test("insertion point when cancel drag on grid view", function() {
|
|
233
237
|
SC.Event.trigger(layer, 'keydown', [ev]);
|
234
238
|
|
235
239
|
equals(gridView._insertionPointView, null, "The insertion point should have been destroyed");
|
240
|
+
equals(gridView._didCallDragEnded, true, "dragEnded should have been call");
|
236
241
|
|
237
242
|
start();
|
238
243
|
};
|
@@ -44,7 +44,12 @@ var pane = SC.ControlTestPane.design()
|
|
44
44
|
contentValueKey: "title",
|
45
45
|
contentCheckboxKey: "isDone",
|
46
46
|
contentUnreadCountKey: "unread",
|
47
|
-
rowHeight: 20
|
47
|
+
rowHeight: 20,
|
48
|
+
_didCallDragEnded: false,
|
49
|
+
dragEnded: function() {
|
50
|
+
sc_super();
|
51
|
+
this._didCallDragEnded = true;
|
52
|
+
}
|
48
53
|
})
|
49
54
|
}));
|
50
55
|
|
@@ -225,6 +230,7 @@ test("insertion point when cancel drag on list view", function() {
|
|
225
230
|
SC.Event.trigger(layer, 'keydown', [ev]);
|
226
231
|
|
227
232
|
equals(listView._insertionPointView, null, "The insertion point should have been destroyed");
|
233
|
+
equals(listView._didCallDragEnded, true, "dragEnded should have been call");
|
228
234
|
|
229
235
|
window.start();
|
230
236
|
};
|
@@ -4,6 +4,7 @@
|
|
4
4
|
// portions copyright @2011 Apple Inc.
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
|
+
/*global module, test, ok, equals, htmlbody, clearHtmlbody */
|
7
8
|
|
8
9
|
/* Test SC.StackedView with a Comments example. */
|
9
10
|
|
@@ -27,7 +28,7 @@ var CommentView = SC.View.extend(SC.Control, {
|
|
27
28
|
|
28
29
|
contentCommentKey: 'comment',
|
29
30
|
|
30
|
-
contentPropertyDidChange: function(target, key) {
|
31
|
+
contentPropertyDidChange: function (target, key) {
|
31
32
|
|
32
33
|
// update everything!
|
33
34
|
if (key === '*') {
|
@@ -41,16 +42,17 @@ var CommentView = SC.View.extend(SC.Control, {
|
|
41
42
|
if (this.owner && this.owner.updateHeight) this.owner.updateHeight();
|
42
43
|
},
|
43
44
|
|
44
|
-
updateFromLabel: function() {
|
45
|
+
updateFromLabel: function () {
|
45
46
|
var content = this.get('content'),
|
46
47
|
from = content ? content.get('from') : 'Anonymous',
|
47
48
|
date = content ? content.get('date') : 'some date',
|
48
49
|
str = "%@ wrote %@: ".fmt(from, date);
|
49
50
|
this.fromLabel.set('value', str);
|
50
|
-
|
51
|
+
|
52
|
+
return this;
|
51
53
|
},
|
52
54
|
|
53
|
-
updateCommentLabel: function() {
|
55
|
+
updateCommentLabel: function () {
|
54
56
|
var content = this.get('content'),
|
55
57
|
comment = content ? content.get('comment') : '(No Comment)';
|
56
58
|
this.commentLabel.set('value', comment);
|
@@ -122,7 +124,7 @@ var extra = SC.Object.create({
|
|
122
124
|
|
123
125
|
var pane = SC.ControlTestPane.design()
|
124
126
|
.add("basic", SC.StackedView, {
|
125
|
-
layout: { top: 0, left: 0, right: 0
|
127
|
+
layout: { top: 0, left: 0, right: 0 },
|
126
128
|
content: content,
|
127
129
|
exampleView: CommentView
|
128
130
|
});
|
@@ -131,7 +133,7 @@ var pane = SC.ControlTestPane.design()
|
|
131
133
|
// BASIC TESTS
|
132
134
|
//
|
133
135
|
module("Basic Tests", {
|
134
|
-
setup: function(){
|
136
|
+
setup: function () {
|
135
137
|
htmlbody(["<style>",
|
136
138
|
'.sc-stacked-view { border-bottom: 1px red solid; }',
|
137
139
|
'.comment-view.sel { background-color: #ccc; }',
|
@@ -140,20 +142,20 @@ module("Basic Tests", {
|
|
140
142
|
'</style>'].join("\n"));
|
141
143
|
pane.standardSetup().setup();
|
142
144
|
},
|
143
|
-
teardown: function(){
|
145
|
+
teardown: function () {
|
144
146
|
pane.standardSetup().teardown();
|
145
147
|
clearHtmlbody();
|
146
148
|
}
|
147
149
|
});
|
148
150
|
|
149
|
-
test("removing an item should delete childView and adjust height", function() {
|
151
|
+
test("removing an item should delete childView and adjust height", function () {
|
150
152
|
var view = pane.view('basic'),
|
151
153
|
item = content[0];
|
152
154
|
|
153
155
|
equals(view.getPath('childViews.length'), content.length, 'precond - should have child views equal to current content');
|
154
156
|
var oldHeight = view.get('frame').height; // save height.
|
155
157
|
|
156
|
-
SC.run(function() { content.removeAt(0); }); // remove first item
|
158
|
+
SC.run(function () { content.removeAt(0); }); // remove first item
|
157
159
|
|
158
160
|
|
159
161
|
equals(view.getPath('childViews.length'), content.length, 'view should remove childView for removed content items');
|
@@ -161,20 +163,20 @@ test("removing an item should delete childView and adjust height", function() {
|
|
161
163
|
ok(newHeight < oldHeight, 'view height should adjust to reflect new content. (old height: %@ current height: %@)'.fmt(oldHeight, newHeight));
|
162
164
|
|
163
165
|
// restore old content
|
164
|
-
SC.run(function() { content.insertAt(0, item); });
|
166
|
+
SC.run(function () { content.insertAt(0, item); });
|
165
167
|
|
166
168
|
});
|
167
169
|
|
168
|
-
window.content = content
|
170
|
+
window.content = content;
|
169
171
|
|
170
|
-
test("inserting an item should add childView and adjust height", function() {
|
172
|
+
test("inserting an item should add childView and adjust height", function () {
|
171
173
|
var view = pane.view('basic'),
|
172
174
|
item = extra; // we will insert another one
|
173
175
|
|
174
176
|
equals(view.getPath('childViews.length'), content.length, 'precond - should have child views equal to current content');
|
175
177
|
var oldHeight = view.get('frame').height; // save height.
|
176
178
|
|
177
|
-
SC.run(function() { content.pushObject(item); }); // add another item
|
179
|
+
SC.run(function () { content.pushObject(item); }); // add another item
|
178
180
|
|
179
181
|
|
180
182
|
equals(view.getPath('childViews.length'), content.length, 'view should add childView for added content item');
|
@@ -182,11 +184,11 @@ test("inserting an item should add childView and adjust height", function() {
|
|
182
184
|
ok(newHeight > oldHeight, 'view height should adjust to reflect new content. (old height: %@ current height: %@)'.fmt(oldHeight, newHeight));
|
183
185
|
|
184
186
|
// restore
|
185
|
-
SC.run(function() { content.popObject(); });
|
187
|
+
SC.run(function () { content.popObject(); });
|
186
188
|
});
|
187
189
|
|
188
190
|
|
189
|
-
test("editing an item should automatically adjust the height", function() {
|
191
|
+
test("editing an item should automatically adjust the height", function () {
|
190
192
|
var view = pane.view('basic'),
|
191
193
|
item = content[0],
|
192
194
|
childView = view.childViews[0],
|
@@ -198,7 +200,7 @@ test("editing an item should automatically adjust the height", function() {
|
|
198
200
|
var height = view.get('frame').height; // save old height
|
199
201
|
|
200
202
|
// change comment
|
201
|
-
SC.run(function() { item.set('comment', 'This is a new comment'); });
|
203
|
+
SC.run(function () { item.set('comment', 'This is a new comment'); });
|
202
204
|
|
203
205
|
// should have updated UI and adjusted height of collection
|
204
206
|
equals(childView.$().find('p').text(), 'This is a new comment', 'Item view should now contain comment');
|
@@ -207,7 +209,7 @@ test("editing an item should automatically adjust the height", function() {
|
|
207
209
|
ok(newHeight < height, 'view height should adjust to reflect new content. (old height: %@ current height: %@)'.fmt(height, newHeight));
|
208
210
|
|
209
211
|
// restore
|
210
|
-
SC.run(function() { item.set('comment', old); });
|
212
|
+
SC.run(function () { item.set('comment', old); });
|
211
213
|
|
212
214
|
newHeight = view.get('frame').height;
|
213
215
|
equals(newHeight, height, 'view height should restore to old height when content is edited again. (old height: %@ current height: %@)'.fmt(height, newHeight));
|
@@ -220,20 +222,20 @@ test("editing an item should automatically adjust the height", function() {
|
|
220
222
|
|
221
223
|
// tests specific bug where a series of many edits strung together would
|
222
224
|
// cause the height to get out of sync.
|
223
|
-
test("adding, removing then editing items should still keep height the same", function() {
|
225
|
+
test("adding, removing then editing items should still keep height the same", function () {
|
224
226
|
|
225
227
|
var view = pane.view('basic'),
|
226
228
|
item = content[0],
|
227
229
|
old = item.get('comment'),
|
228
230
|
height = view.get('frame').height; // save old height
|
229
231
|
|
230
|
-
SC.run(function() { content.removeAt(0); });
|
231
|
-
SC.run(function() { content.insertAt(0, item); });
|
232
|
-
SC.run(function() { content.pushObject(extra); });
|
233
|
-
SC.run(function() { content.popObject(); });
|
232
|
+
SC.run(function () { content.removeAt(0); });
|
233
|
+
SC.run(function () { content.insertAt(0, item); });
|
234
|
+
SC.run(function () { content.pushObject(extra); });
|
235
|
+
SC.run(function () { content.popObject(); });
|
234
236
|
|
235
|
-
SC.run(function() { item.set('comment', 'Short comment'); });
|
236
|
-
SC.run(function() { item.set('comment', old); });
|
237
|
+
SC.run(function () { item.set('comment', 'Short comment'); });
|
238
|
+
SC.run(function () { item.set('comment', old); });
|
237
239
|
|
238
240
|
var newHeight = view.get('frame').height;
|
239
241
|
equals(newHeight, height, 'view height should restore to old height when content is edited again. (old height: %@ current height: %@)'.fmt(height, newHeight));
|
@@ -2291,26 +2291,26 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2291
2291
|
// var itemView = this.itemViewForEvent(touch),
|
2292
2292
|
var itemView = this._touchSelectedView,
|
2293
2293
|
contentIndex = itemView ? itemView.get('contentIndex') : -1,
|
2294
|
-
isSelected = NO, sel;
|
2294
|
+
isSelected = NO, sel, shouldSelect;
|
2295
2295
|
|
2296
2296
|
if (!this.get('isEnabledInPane')) return contentIndex > -1;
|
2297
2297
|
|
2298
|
-
// Remove fake selection in case our contentIndex is -1, a select event will add it back
|
2299
|
-
if (itemView) { itemView.set('isSelected', NO); }
|
2300
|
-
|
2301
2298
|
if (contentIndex > -1) {
|
2302
2299
|
if (this.get('useToggleSelection')) {
|
2303
2300
|
sel = this.get('selection');
|
2304
2301
|
isSelected = sel && sel.containsObject(itemView.get('content'));
|
2302
|
+
shouldSelect = !isSelected;
|
2305
2303
|
}
|
2304
|
+
else
|
2305
|
+
shouldSelect = true;
|
2306
2306
|
|
2307
|
-
if (
|
2308
|
-
this.deselect(contentIndex);
|
2309
|
-
} else {
|
2307
|
+
if (shouldSelect) {
|
2310
2308
|
this.select(contentIndex, NO);
|
2311
2309
|
|
2312
2310
|
// If actOnSelect is implemented, the action will be fired.
|
2313
2311
|
this._cv_performSelectAction(itemView, touch, 0);
|
2312
|
+
} else {
|
2313
|
+
this.deselect(contentIndex);
|
2314
2314
|
}
|
2315
2315
|
}
|
2316
2316
|
|
@@ -2779,15 +2779,6 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2779
2779
|
return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
|
2780
2780
|
},
|
2781
2781
|
|
2782
|
-
/**
|
2783
|
-
Implements the SC.DropTarget protocol. Hides any visible insertion
|
2784
|
-
point and clears some cached values.
|
2785
|
-
*/
|
2786
|
-
dragExited: function () {
|
2787
|
-
this.hideInsertionPoint();
|
2788
|
-
this._lastInsertionIndex = this._lastDropOperation = null;
|
2789
|
-
},
|
2790
|
-
|
2791
2782
|
/**
|
2792
2783
|
Implements the SC.DropTarget protocol. Hides any visible insertion
|
2793
2784
|
point and clears some cached values.
|
@@ -2963,8 +2954,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2963
2954
|
// in-scroll clipping frame when it does).
|
2964
2955
|
// TODO: perform a raw update that doesn't require the run loop.
|
2965
2956
|
SC.run(function () {
|
2966
|
-
|
2967
|
-
|
2957
|
+
this.notifyPropertyChange('nowShowing');
|
2958
|
+
this.invokeOnce('_cv_nowShowingDidChange');
|
2968
2959
|
}, this);
|
2969
2960
|
|
2970
2961
|
// Track the last time we updated.
|