sproutcore 1.11.0.rc1 → 1.11.0.rc2

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.
Files changed (42) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/CHANGELOG.md +93 -65
  4. data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +17 -7
  5. data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +22 -2
  6. data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +14 -0
  7. data/lib/frameworks/sproutcore/apps/showcase/resources/views_page.js +2 -2
  8. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +20 -8
  9. data/lib/frameworks/sproutcore/frameworks/ajax/system/websocket.js +58 -43
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +192 -35
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +7 -3
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +27 -7
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +20 -63
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +16 -7
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +279 -159
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +1 -1
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +21 -10
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +32 -28
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/targetForAction.js +107 -90
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/touch.js +33 -25
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/touch.js +23 -15
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +1 -1
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +12 -6
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +55 -33
  25. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +7 -1
  26. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +228 -72
  27. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/touch.js +54 -100
  28. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +15 -0
  29. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +57 -45
  30. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +9 -16
  31. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +111 -44
  32. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +2 -0
  33. data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +51 -5
  34. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
  35. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +13 -10
  36. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -1
  37. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +28 -9
  38. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +7 -5
  39. data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +51 -46
  40. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +8 -5
  41. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +12 -3
  42. metadata +2 -2
@@ -952,7 +952,7 @@ SC.RenderContext = SC.Builder.create(
952
952
  /**
953
953
  Removes all styles from the context.
954
954
 
955
- Be aware that setStyle() only effects the styles specified. If there
955
+ Be aware that setStyle() only affects the styles specified. If there
956
956
  are existing styles that are not modified by a call to setStyle(), they
957
957
  will remain on the context. For example, if you call addStyle('margin-left', 10)
958
958
  and addStyle('margin-right', 10) followed by setClass({ 'margin-right': null }),
@@ -575,10 +575,14 @@ SC.RootResponder = SC.Object.extend(
575
575
  sendAction: function( action, target, sender, pane, context, firstResponder) {
576
576
  target = this.targetForAction(action, target, sender, pane, firstResponder) ;
577
577
 
578
- // HACK: If the target is a ResponderContext, forward the action.
579
- if (target && target.isResponderContext) {
580
- return !!target.sendAction(action, sender, context, firstResponder);
581
- } else return target && target.tryToPerform(action, sender);
578
+ if (target) {
579
+ // HACK: If the target is a ResponderContext, forward the action.
580
+ if (target.isResponderContext) {
581
+ return !!target.sendAction(action, sender, context, firstResponder);
582
+ } else {
583
+ return target.tryToPerform(action, sender, context);
584
+ }
585
+ }
582
586
  },
583
587
 
584
588
  _responderFor: function(target, methodName, firstResponder) {
@@ -634,11 +638,13 @@ SC.RootResponder = SC.Object.extend(
634
638
 
635
639
  // 2. an explicit target was passed...
636
640
  if (target) {
641
+ // Normalize String targets to Objects
637
642
  if (SC.typeOf(target) === SC.T_STRING) {
638
- target = SC.objectForPropertyPath(target) ||
639
- SC.objectForPropertyPath(target, sender);
643
+ target = SC.objectForPropertyPath(target) ||
644
+ SC.objectForPropertyPath(target, sender);
640
645
  }
641
646
 
647
+ // Ensure that the target responds to the method.
642
648
  if (target && !target.isResponderContext) {
643
649
  if (target.respondsTo && !target.respondsTo(methodName)) {
644
650
  target = null ;
@@ -717,7 +723,7 @@ SC.RootResponder = SC.Object.extend(
717
723
  sendEvent: function(action, evt, target) {
718
724
  var pane, ret ;
719
725
 
720
- SC.run(function() {
726
+ SC.run(function send_event() {
721
727
  // get the target pane
722
728
  if (target) pane = target.get('pane') ;
723
729
  else pane = this.get('menuPane') || this.get('keyPane') || this.get('mainPane') ;
@@ -848,7 +854,6 @@ SC.RootResponder = SC.Object.extend(
848
854
  var responder = this ;
849
855
 
850
856
  document.body['on' + keyName] = function(e) {
851
- // return method.call(responder, SC.Event.normalizeEvent(e));
852
857
  return method.call(responder, SC.Event.normalizeEvent(event || window.event)); // this is IE :(
853
858
  };
854
859
 
@@ -1549,7 +1554,9 @@ SC.RootResponder = SC.Object.extend(
1549
1554
  //@endif
1550
1555
 
1551
1556
  // loop through changed touches, calling touchStart, etc.
1552
- var idx, touches = evt.changedTouches, len = touches.length,
1557
+ var changedTouches = evt.changedTouches,
1558
+ len = changedTouches.length,
1559
+ idx,
1553
1560
  touch, touchEntry;
1554
1561
 
1555
1562
  // prepare event for touch mapping.
@@ -1557,7 +1564,7 @@ SC.RootResponder = SC.Object.extend(
1557
1564
 
1558
1565
  // Loop through each touch we received in this event
1559
1566
  for (idx = 0; idx < len; idx++) {
1560
- touch = touches[idx];
1567
+ touch = changedTouches[idx];
1561
1568
 
1562
1569
  // Create an SC.Touch instance for every touch.
1563
1570
  touchEntry = SC.Touch.create(touch, this);
@@ -1587,6 +1594,8 @@ SC.RootResponder = SC.Object.extend(
1587
1594
  // Unset the reference to the original event so we can garbage collect.
1588
1595
  touchEntry.event = null;
1589
1596
  }
1597
+
1598
+ evt.touchContext = null;
1590
1599
  }, this);
1591
1600
 
1592
1601
  // hack for text fields
@@ -1716,6 +1725,8 @@ SC.RootResponder = SC.Object.extend(
1716
1725
  touchEntry = this._touches[touch.identifier];
1717
1726
  if (touchEntry) touchEntry.event = null;
1718
1727
  }
1728
+ evt.touchContext = null;
1729
+ evt.viewChangedTouches = null;
1719
1730
  }, this);
1720
1731
 
1721
1732
  return evt.hasCustomEventHandling;
@@ -24,13 +24,7 @@
24
24
  });
25
25
 
26
26
  view = SC.View.create(SC.ActionSupport, {
27
- action: null,
28
- zomgAction: null,
29
- pane: pane,
30
-
31
- someEvent: function() {
32
- return this.fireAction(this.get('zomgAction'));
33
- }
27
+ pane: pane
34
28
  });
35
29
  },
36
30
 
@@ -41,10 +35,10 @@
41
35
 
42
36
 
43
37
  // ..........................................................
44
- // No Parameters
38
+ // No Arguments
45
39
  //
46
40
 
47
- test("no paramaters - only action set", function() {
41
+ test("no arguments - only action set", function() {
48
42
  var expectedAction = 'someAction';
49
43
 
50
44
  view.set('action', expectedAction);
@@ -53,11 +47,11 @@
53
47
  ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, null, view), 'triggers the action');
54
48
  });
55
49
 
56
- test("no paramaters - action and target set", function() {
50
+ test("no arguments - action and target set", function() {
57
51
  var expectedAction = 'someAction';
58
52
 
59
- view.set('target', target);
60
53
  view.set('action', expectedAction);
54
+ view.set('target', target);
61
55
  view.fireAction();
62
56
 
63
57
  ok(sendActionSpy.wasCalledWith(expectedAction, target, view, pane, null, view), 'triggers the action');
@@ -65,40 +59,50 @@
65
59
 
66
60
 
67
61
  // ..........................................................
68
- // Actions Parameter
62
+ // Arguments
69
63
  //
70
64
 
71
- test("action parameter - only action set", function() {
65
+ test("context argument", function() {
72
66
  var expectedAction = 'someAction';
67
+ var context = { zomg: "context" };
73
68
 
74
- view.set('zomgAction', expectedAction);
75
- view.someEvent();
69
+ view.set('action', expectedAction);
70
+ view.fireAction(context);
76
71
 
77
- ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, null, view), 'triggers the action');
72
+ ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, context, view), 'triggers the action');
78
73
  });
79
74
 
80
- test("action parameter - action and target set", function() {
75
+
76
+ // ..........................................................
77
+ // Backwards-compatibility
78
+ //
79
+
80
+ test("backwards-compatibility actionContext property", function() {
81
81
  var expectedAction = 'someAction';
82
+ var context = { zomg: "context" };
82
83
 
83
- view.set('target', target);
84
- view.set('zomgAction', expectedAction);
85
- view.someEvent();
84
+ view.set('action', expectedAction);
85
+ view.set('actionContext', context);
86
+ view.fireAction();
86
87
 
87
- ok(sendActionSpy.wasCalledWith(expectedAction, target, view, pane, null, view), 'triggers the action');
88
+ ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, context, view), 'triggers the action');
88
89
  });
89
90
 
91
+ test("backwards-compatibility action argument", function() {
92
+ var expectedAction = 'someAction';
93
+ var context = { zomg: "context" };
90
94
 
91
- // ..........................................................
92
- // Action Context
93
- //
95
+ view.fireAction(expectedAction);
94
96
 
95
- test("context", function() {
97
+ ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, null, view), 'triggers the action');
98
+ });
99
+
100
+ test("backwards-compatibility String context argument", function() {
96
101
  var expectedAction = 'someAction';
97
- var context = {zomg: "context"};
102
+ var context = "context";
98
103
 
99
104
  view.set('action', expectedAction);
100
- view.set('actionContext', context)
101
- view.fireAction();
105
+ view.fireAction(context);
102
106
 
103
107
  ok(sendActionSpy.wasCalledWith(expectedAction, null, view, pane, context, view), 'triggers the action');
104
108
  });
@@ -7,64 +7,68 @@
7
7
  /*global module test equals context ok same Q$ htmlbody Dummy */
8
8
 
9
9
  var r, r2, sender, pane, pane2, barView, fooView, defaultResponder;
10
- var keyPane, mainPane, globalResponder, globalResponderContext, actionSender ;
10
+ var keyPane, mainPane, globalResponder, globalResponderContext, actionSender, actionContext;
11
11
 
12
12
  var CommonSetup = {
13
- setup: function() {
14
-
15
- actionSender = null ; // use for sendAction tests
16
- var action = function(sender) { actionSender = sender; } ;
17
-
13
+ setup: function() {
14
+
15
+ actionSender = null; // use for sendAction tests
16
+ actionContext = null;
17
+ var action = function (sender, context) {
18
+ actionSender = sender;
19
+ actionContext = context;
20
+ };
21
+
18
22
  sender = SC.Object.create();
19
-
23
+
20
24
  // default responder for each pane
21
- defaultResponder = SC.Object.create({
22
- defaultAction: action
25
+ defaultResponder = SC.Object.create({
26
+ defaultAction: action
23
27
  });
24
28
 
25
29
  // global default responder set on RootResponder
26
- globalResponder = SC.Object.create({
27
- globalAction: action
30
+ globalResponder = SC.Object.create({
31
+ globalAction: action
28
32
  });
29
-
30
- // global default responder as a responder context
33
+
34
+ // global default responder as a responder context
31
35
  // set on RootResponder
32
36
  globalResponderContext = SC.Object.create(SC.ResponderContext, {
33
37
  globalAction: action
34
38
  });
35
-
39
+
36
40
  // explicit pane
37
- pane = SC.Pane.create({
41
+ pane = SC.Pane.create({
38
42
  acceptsKeyPane: YES,
39
43
  defaultResponder: defaultResponder,
40
44
  childViews: [SC.View.extend({
41
45
  bar: action, // implement bar action
42
46
  childViews: [SC.View.extend({
43
47
  foo: action // implement foo action
44
- })]
48
+ })]
45
49
  })],
46
-
50
+
47
51
  paneAction: action
48
-
52
+
49
53
  });
50
-
51
- pane2 = SC.Pane.create({
54
+
55
+ pane2 = SC.Pane.create({
52
56
  acceptsKeyPane: YES,
53
57
  defaultResponder: defaultResponder,
54
58
  childViews: [SC.View.extend({
55
59
  bar: action, // implement bar action
56
60
  childViews: [SC.View.extend({
57
61
  foo: action // implement foo action
58
- })]
62
+ })]
59
63
  })],
60
-
64
+
61
65
  paneAction: action,
62
-
66
+
63
67
  keyAction: action,
64
68
  mainAction: action,
65
69
  globalAction: action
66
70
  });
67
-
71
+
68
72
  keyPane = SC.Pane.create({
69
73
  acceptsKeyPane: YES,
70
74
  keyAction: action
@@ -78,54 +82,54 @@ var CommonSetup = {
78
82
  mainPane.firstResponder = mainPane ;
79
83
 
80
84
  r = SC.RootResponder.create({
81
- mainPane: mainPane,
85
+ mainPane: mainPane,
82
86
  keyPane: keyPane,
83
- defaultResponder: globalResponder
84
- });
85
-
87
+ defaultResponder: globalResponder
88
+ });
89
+
86
90
  r2 = SC.RootResponder.create({
87
91
  mainPane: mainPane,
88
92
  keyPane: keyPane,
89
93
  defaultResponder: globalResponderContext
90
94
  });
91
-
95
+
92
96
  barView = pane.childViews[0];
93
97
  ok(barView.bar, 'barView should implement bar');
94
-
98
+
95
99
  fooView = barView.childViews[0];
96
100
  ok(fooView.foo, 'fooView should implement foo');
97
-
101
+
98
102
  // setup dummy namespace
99
- window.Dummy = {
103
+ window.Dummy = {
100
104
  object: SC.Object.create({ foo: action }),
101
- hash: { foo: action }
105
+ hash: { foo: action }
102
106
  };
103
-
107
+
104
108
  },
105
109
 
106
110
  teardown: function() {
107
- r = r2 = sender = pane = window.Dummy = barView = fooView = null;
108
- defaultResponder = keyPane = mainPane = globalResponder = null;
109
- globalResponderContext = null;
111
+ r = r2 = sender = pane = window.Dummy = barView = fooView = null;
112
+ defaultResponder = keyPane = mainPane = globalResponder = null;
113
+ globalResponderContext = null;
110
114
  }
111
115
  };
112
116
 
113
117
  // ..........................................................
114
118
  // targetForAction()
115
- //
119
+ //
116
120
  module("SC.RootResponder#targetForAction", CommonSetup);
117
121
 
118
122
 
119
123
  test("pass property path string as target", function() {
120
124
  var result = r.targetForAction('foo', 'Dummy.object');
121
-
125
+
122
126
  equals(result, Dummy.object, 'should find DummyNamespace.object if it implements the action');
123
127
 
124
128
  equals(r.targetForAction("foo", "Dummy.hash"), Dummy.hash, 'should return if object found at path and it has function, even if it does not use respondsTo');
125
-
129
+
126
130
  equals(r.targetForAction('bar', 'Dummy.object'), null, 'should return null if found DummyNamepace.object but does not implement action');
127
-
128
- equals(r.targetForAction('foo', 'Dummy.imaginary.item'), null, 'should return null if property path could not resolve');
131
+
132
+ equals(r.targetForAction('foo', 'Dummy.imaginary.item'), null, 'should return null if property path could not resolve');
129
133
  });
130
134
 
131
135
  test("pass real object as target", function() {
@@ -135,96 +139,96 @@ test("pass real object as target", function() {
135
139
  });
136
140
 
137
141
  test("no target, explicit pane, nested firstResponder", function() {
138
-
142
+
139
143
  pane.set('firstResponder', fooView) ;
140
- equals(r.targetForAction('foo', null, null, pane), fooView,
144
+ equals(r.targetForAction('foo', null, null, pane), fooView,
141
145
  'should return firstResponder if implementation action');
142
-
143
- equals(r.targetForAction('bar', null, null, pane), barView,
146
+
147
+ equals(r.targetForAction('bar', null, null, pane), barView,
144
148
  'should return parent of firstResponder');
145
149
 
146
- equals(r.targetForAction('paneAction', null, null, pane), pane,
150
+ equals(r.targetForAction('paneAction', null, null, pane), pane,
147
151
  'should return pane action');
148
-
149
- equals(r.targetForAction('defaultAction', null, null, pane),
152
+
153
+ equals(r.targetForAction('defaultAction', null, null, pane),
150
154
  defaultResponder, 'should return defaultResponder');
151
155
 
152
- equals(r.targetForAction('imaginaryAction', null, null, pane), null,
156
+ equals(r.targetForAction('imaginaryAction', null, null, pane), null,
153
157
  'should return null for not-found action');
154
158
  });
155
159
 
156
160
 
157
161
  test("no target, explicit pane, top-level firstResponder", function() {
158
-
162
+
159
163
  pane.set('firstResponder', barView) ; // fooView is child...
160
-
161
- equals(r.targetForAction('foo', null, null, pane), null,
164
+
165
+ equals(r.targetForAction('foo', null, null, pane), null,
162
166
  'should NOT return child of firstResponder');
163
-
164
- equals(r.targetForAction('bar', null, null, pane), barView,
167
+
168
+ equals(r.targetForAction('bar', null, null, pane), barView,
165
169
  'should return firstResponder');
166
170
 
167
- equals(r.targetForAction('paneAction', null, null, pane), pane,
171
+ equals(r.targetForAction('paneAction', null, null, pane), pane,
168
172
  'should return pane action');
169
-
170
- equals(r.targetForAction('defaultAction', null, null, pane),
173
+
174
+ equals(r.targetForAction('defaultAction', null, null, pane),
171
175
  defaultResponder, 'should return defaultResponder');
172
176
 
173
- equals(r.targetForAction('imaginaryAction', null, null, pane), null,
177
+ equals(r.targetForAction('imaginaryAction', null, null, pane), null,
174
178
  'should return null for not-found action');
175
179
  });
176
180
 
177
181
  test("no target, explicit pane, pane is first responder", function() {
178
-
179
- pane.set('firstResponder', pane) ;
180
-
181
- equals(r.targetForAction('foo', null, null, pane), null,
182
+
183
+ pane.set('firstResponder', pane) ;
184
+
185
+ equals(r.targetForAction('foo', null, null, pane), null,
182
186
  'should NOT return child view');
183
-
184
- equals(r.targetForAction('bar', null, null, pane), null,
187
+
188
+ equals(r.targetForAction('bar', null, null, pane), null,
185
189
  'should NOT return child view');
186
190
 
187
- equals(r.targetForAction('paneAction', null, null, pane), pane,
191
+ equals(r.targetForAction('paneAction', null, null, pane), pane,
188
192
  'should return pane action');
189
-
190
- equals(r.targetForAction('defaultAction', null, null, pane),
193
+
194
+ equals(r.targetForAction('defaultAction', null, null, pane),
191
195
  defaultResponder, 'should return defaultResponder');
192
196
 
193
- equals(r.targetForAction('imaginaryAction', null, null, pane), null,
197
+ equals(r.targetForAction('imaginaryAction', null, null, pane), null,
194
198
  'should return null for not-found action');
195
199
  });
196
200
 
197
201
  test("no target, explicit pane, no first responder", function() {
198
-
199
- pane.set('firstResponder', null) ;
200
-
201
- equals(r.targetForAction('foo', null, null, pane), null,
202
+
203
+ pane.set('firstResponder', null) ;
204
+
205
+ equals(r.targetForAction('foo', null, null, pane), null,
202
206
  'should NOT return child view');
203
-
204
- equals(r.targetForAction('bar', null, null, pane), null,
207
+
208
+ equals(r.targetForAction('bar', null, null, pane), null,
205
209
  'should NOT return child view');
206
210
 
207
- equals(r.targetForAction('paneAction', null, null, pane), pane,
211
+ equals(r.targetForAction('paneAction', null, null, pane), pane,
208
212
  'should return pane');
209
-
210
- equals(r.targetForAction('defaultAction', null, null, pane),
213
+
214
+ equals(r.targetForAction('defaultAction', null, null, pane),
211
215
  defaultResponder, 'should return defaultResponder');
212
-
213
- equals(r.targetForAction('imaginaryAction', null, null, pane), null,
216
+
217
+ equals(r.targetForAction('imaginaryAction', null, null, pane), null,
214
218
  'should return null for not-found action');
215
-
219
+
216
220
  });
217
221
 
218
222
  test("no target, explicit pane, does not implement action", function() {
219
223
  equals(r.targetForAction('keyAction', null, null, pane), keyPane,
220
224
  'should return keyPane');
221
-
225
+
222
226
  equals(r.targetForAction('mainAction', null, null, pane), mainPane,
223
227
  'should return mainPane');
224
228
 
225
229
  equals(r.targetForAction('globalAction', null, null, pane), globalResponder,
226
230
  'should return global defaultResponder');
227
-
231
+
228
232
  equals(r2.targetForAction('globalAction', null, null, pane), globalResponderContext,
229
233
  'should return global defaultResponder');
230
234
  });
@@ -232,15 +236,15 @@ test("no target, explicit pane, does not implement action", function() {
232
236
  test("no target, explicit pane, does implement action", function() {
233
237
  equals(r.targetForAction('keyAction', null, null, pane2), pane2,
234
238
  'should return pane');
235
-
239
+
236
240
  equals(r.targetForAction('mainAction', null, null, pane2), pane2,
237
241
  'should return pane');
238
242
 
239
243
  equals(r.targetForAction('globalAction', null, null, pane2), pane2,
240
244
  'should return pane');
241
-
245
+
242
246
  equals(r2.targetForAction('globalAction', null, null, pane2), pane2,
243
- 'should return pane');
247
+ 'should return pane');
244
248
  });
245
249
 
246
250
  test("no target, no explicit pane", function() {
@@ -255,14 +259,27 @@ test("no target, no explicit pane", function() {
255
259
 
256
260
  // ..........................................................
257
261
  // sendAction()
258
- //
262
+ //
259
263
  module("SC.RootResponder#sendAction", CommonSetup) ;
260
264
 
265
+ test("if context given, passes context to action + target", function() {
266
+ var context = {};
267
+
268
+ // pane.firstResponder = defaultResponder;
269
+ r.sendAction('defaultAction', defaultResponder, sender, pane, context);
270
+ equals(actionSender, sender, 'action did invoke');
271
+ equals(actionContext, context, 'context was passed');
272
+
273
+ actionSender = null;
274
+ r.sendAction('imaginaryAction', null, sender, pane);
275
+ equals(actionSender, null, 'action did not invoke');
276
+ });
277
+
261
278
  test("if pane passed, invokes action on pane if found", function() {
262
279
  pane.firstResponder = pane;
263
280
  r.sendAction('paneAction', null, sender, pane);
264
281
  equals(actionSender, sender, 'action did invoke');
265
-
282
+
266
283
  actionSender = null;
267
284
  r.sendAction('imaginaryAction', null, sender, pane);
268
285
  equals(actionSender, null, 'action did not invoke');
@@ -271,7 +288,7 @@ test("if pane passed, invokes action on pane if found", function() {
271
288
  test("searches panes if none passed, invokes action if found", function() {
272
289
  r.sendAction('keyAction', null, sender);
273
290
  equals(actionSender, sender, 'action did invoke');
274
-
291
+
275
292
  actionSender = null;
276
293
  r.sendAction('imaginaryAction', null, sender);
277
294
  equals(actionSender, null, 'action did not invoke');
@@ -280,7 +297,7 @@ test("searches panes if none passed, invokes action if found", function() {
280
297
  test("searches target if passed, invokes action if found", function() {
281
298
  r.sendAction('foo', fooView, sender);
282
299
  equals(actionSender, sender, 'action did invoke');
283
-
300
+
284
301
  actionSender = null;
285
302
  r.sendAction('imaginaryAction', fooView, sender);
286
303
  equals(actionSender, null, 'action did not invoke');