sproutcore 1.10.0.rc.2 → 1.10.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/CHANGELOG.md +14 -0
  4. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +9 -1
  5. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +7 -0
  6. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +14 -0
  7. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +103 -0
  8. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +4 -4
  9. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +4 -1
  10. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +5 -5
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +17 -6
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +62 -8
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +14 -2
  14. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +26 -5
  15. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/many_array.js +9 -1
  16. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +6 -2
  17. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/split_child.js +1 -1
  18. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +0 -2
  19. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/render.js +56 -54
  20. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +221 -171
  21. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +261 -315
  22. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/split_child.js +137 -122
  23. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +1 -1
  24. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +10 -7
  25. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +5 -4
  26. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +14 -14
  27. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +123 -98
  28. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_display.js +18 -6
  29. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/api.js +9 -11
  30. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +2 -2
  31. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +15 -16
  32. data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +11 -0
  33. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
  34. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +3 -3
  35. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +170 -153
  36. data/lib/frameworks/sproutcore/frameworks/table/views/table.js +105 -101
  37. data/lib/frameworks/sproutcore/frameworks/table/views/table_head.js +0 -7
  38. data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +46 -56
  39. data/lib/frameworks/sproutcore/frameworks/table/views/table_row.js +0 -6
  40. data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/collection.js +12 -4
  41. data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +3 -2
  42. data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +11 -8
  43. data/lib/frameworks/sproutcore/tests/phantomjs_runner.phantomjs +0 -1
  44. metadata +3 -3
  45. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -235
@@ -7,19 +7,19 @@
7
7
  // ========================================================================
8
8
  // SC.Binding Tests
9
9
  // ========================================================================
10
- /*globals module test ok isObj equals expects */
10
+ /*globals module, test, ok, isObj, equals, expects */
11
11
 
12
- var fromObject, toObject, binding, Bon1, bon2 ; // global variables
12
+ var fromObject, midObject, toObject, binding, Bon1, bon2, first, second, third, binding1, binding2;
13
13
 
14
14
  module("basic object binding", {
15
15
 
16
16
  setup: function () {
17
- fromObject = SC.Object.create({ value: 'start' }) ;
17
+ fromObject = SC.Object.create({ value: 'start' });
18
18
  midObject = SC.Object.create({ value: 'middle' });
19
- toObject = SC.Object.create({ value: 'end' }) ;
20
- binding1 = SC.Binding.from("value", fromObject).to("value", midObject).connect() ;
19
+ toObject = SC.Object.create({ value: 'end' });
20
+ binding1 = SC.Binding.from("value", fromObject).to("value", midObject).connect();
21
21
  binding2 = SC.Binding.from("value", midObject).to("value", toObject).connect();
22
- SC.Binding.flushPendingChanges() ; // actually sets up up the connection
22
+ SC.Binding.flushPendingChanges(); // actually sets up up the connection
23
23
  },
24
24
 
25
25
  teardown: function () {
@@ -30,56 +30,56 @@ module("basic object binding", {
30
30
  }
31
31
  });
32
32
 
33
- test("binding is connected", function() {
34
- equals(binding1.isConnected, YES, "binding1.isConnected") ;
35
- equals(binding2.isConnected, YES, "binding2.isConnected") ;
33
+ test("binding is connected", function () {
34
+ equals(binding1.isConnected, YES, "binding1.isConnected");
35
+ equals(binding2.isConnected, YES, "binding2.isConnected");
36
36
  });
37
37
 
38
- test("binding has actually been setup", function() {
39
- equals(binding1._connectionPending, NO, "binding1._connectionPending") ;
40
- equals(binding2._connectionPending, NO, "binding2._connectionPending") ;
38
+ test("binding has actually been setup", function () {
39
+ equals(binding1._connectionPending, NO, "binding1._connectionPending");
40
+ equals(binding2._connectionPending, NO, "binding2._connectionPending");
41
41
  });
42
42
 
43
- test("binding should have synced on connect", function() {
43
+ test("binding should have synced on connect", function () {
44
44
  equals(toObject.get("value"), "start", "toObject.value should match fromObject.value");
45
45
  equals(midObject.get("value"), "start", "midObject.value should match fromObject.value");
46
46
  });
47
47
 
48
- test("changing fromObject should mark binding as dirty", function() {
49
- fromObject.set("value", "change") ;
48
+ test("changing fromObject should mark binding as dirty", function () {
49
+ fromObject.set("value", "change");
50
50
  ok(SC.Binding._changeQueue.contains(binding1), "the binding should be in the _changeQueue");
51
- SC.Binding.flushPendingChanges() ;
51
+ SC.Binding.flushPendingChanges();
52
52
  ok(SC.Binding._changeQueue.contains(binding2), "the binding should be in the _changeQueue");
53
53
  });
54
54
 
55
- test("fromObject change should propogate to toObject only after flush", function() {
56
- fromObject.set("value", "change") ;
57
- equals(midObject.get("value"), "start") ;
58
- equals(toObject.get("value"), "start") ;
59
- SC.Binding.flushPendingChanges() ;
60
- equals(midObject.get("value"), "change") ;
61
- SC.Binding.flushPendingChanges() ;
62
- equals(toObject.get("value"), "change") ;
55
+ test("fromObject change should propogate to toObject only after flush", function () {
56
+ fromObject.set("value", "change");
57
+ equals(midObject.get("value"), "start");
58
+ equals(toObject.get("value"), "start");
59
+ SC.Binding.flushPendingChanges();
60
+ equals(midObject.get("value"), "change");
61
+ SC.Binding.flushPendingChanges();
62
+ equals(toObject.get("value"), "change");
63
63
  });
64
64
 
65
- test("changing toObject should mark binding as dirty", function() {
66
- toObject.set("value", "change") ;
65
+ test("changing toObject should mark binding as dirty", function () {
66
+ toObject.set("value", "change");
67
67
  ok(SC.Binding._changeQueue.contains(binding2), "the binding should be in the _changeQueue");
68
- SC.Binding.flushPendingChanges() ;
68
+ SC.Binding.flushPendingChanges();
69
69
  ok(SC.Binding._changeQueue.contains(binding1), "the binding should be in the _changeQueue");
70
70
  });
71
71
 
72
- test("toObject change should propogate to fromObject only after flush", function() {
73
- toObject.set("value", "change") ;
74
- equals(midObject.get("value"), "start") ;
75
- equals(fromObject.get("value"), "start") ;
76
- SC.Binding.flushPendingChanges() ;
77
- equals(midObject.get("value"), "change") ;
78
- SC.Binding.flushPendingChanges() ;
79
- equals(fromObject.get("value"), "change") ;
72
+ test("toObject change should propogate to fromObject only after flush", function () {
73
+ toObject.set("value", "change");
74
+ equals(midObject.get("value"), "start");
75
+ equals(fromObject.get("value"), "start");
76
+ SC.Binding.flushPendingChanges();
77
+ equals(midObject.get("value"), "change");
78
+ SC.Binding.flushPendingChanges();
79
+ equals(fromObject.get("value"), "change");
80
80
  });
81
81
 
82
- test("suspended observing during bindings", function() {
82
+ test("suspended observing during bindings", function () {
83
83
 
84
84
  // setup special binding
85
85
  fromObject = SC.Object.create({
@@ -93,7 +93,7 @@ test("suspended observing during bindings", function() {
93
93
 
94
94
  callCount: 0,
95
95
 
96
- observer: function() {
96
+ observer: function () {
97
97
  equals(this.get('value1'), 'CHANGED', 'value1 when observer fires');
98
98
  equals(this.get('value2'), 'CHANGED', 'value2 when observer fires');
99
99
  this.callCount++;
@@ -111,12 +111,12 @@ test("suspended observing during bindings", function() {
111
111
  equals(toObject.callCount, 2, 'should call observer twice');
112
112
  });
113
113
 
114
- test("binding will disconnect", function() {
114
+ test("binding will disconnect", function () {
115
115
  binding1.disconnect();
116
116
  equals(binding1.isConnected, NO, "binding1.isConnected");
117
117
  });
118
118
 
119
- test("binding disconnection actually works", function() {
119
+ test("binding disconnection actually works", function () {
120
120
  binding1.disconnect();
121
121
  fromObject.set('value', 'change');
122
122
  SC.Binding.flushPendingChanges();
@@ -131,15 +131,15 @@ test("binding disconnection actually works", function() {
131
131
  equals(toObject.get('value'), 'change');
132
132
  });
133
133
 
134
- test("binding destruction actually works", function() {
135
- binding1.destroy()
134
+ test("binding destruction actually works", function () {
135
+ binding1.destroy();
136
136
  ok(binding1.isDestroyed, "binding marks itself as destroyed.");
137
137
  ok(!binding1._fromTarget && !binding1._toTarget, "binding destruction removes binding targets.");
138
138
  });
139
139
 
140
140
  module("bindings on classes");
141
141
 
142
- test("should connect when multiple instances of class are created", function() {
142
+ test("should connect when multiple instances of class are created", function () {
143
143
  window.TestNamespace = {};
144
144
  window.TestNamespace.stubController = SC.Object.create({
145
145
  name: 'How to Be Happy'
@@ -152,14 +152,14 @@ test("should connect when multiple instances of class are created", function() {
152
152
 
153
153
  var myFirstObj;
154
154
 
155
- SC.run(function() { myFirstObj = myClass.create(); });
155
+ SC.run(function () { myFirstObj = myClass.create(); });
156
156
  equals(myFirstObj.get('foo'), "How to Be Happy");
157
157
 
158
158
  var mySecondObj;
159
- SC.run(function() { mySecondObj = myClass.create() });
159
+ SC.run(function () { mySecondObj = myClass.create(); });
160
160
  equals(mySecondObj.get('foo'), "How to Be Happy");
161
161
 
162
- SC.run(function() { myFirstObj.destroy(); })
162
+ SC.run(function () { myFirstObj.destroy(); });
163
163
  ok(myFirstObj.fooBinding.isDestroyed, "destroying an object destroys its class bindings.");
164
164
 
165
165
  } finally {
@@ -168,146 +168,163 @@ test("should connect when multiple instances of class are created", function() {
168
168
  });
169
169
 
170
170
  module("one way binding", {
171
- setup: function() {
172
- fromObject = SC.Object.create({ value: 'start' }) ;
173
- toObject = SC.Object.create({ value: 'end' }) ;
174
- binding = SC.Binding.from("value", fromObject).to("value", toObject).oneWay().connect() ;
175
- SC.Binding.flushPendingChanges() ; // actually sets up up the connection
171
+ setup: function () {
172
+ fromObject = SC.Object.create({ value: 'start' });
173
+ toObject = SC.Object.create({ value: 'end' });
174
+ binding = SC.Binding.from("value", fromObject).to("value", toObject).oneWay().connect();
175
+ SC.Binding.flushPendingChanges(); // actually sets up up the connection
176
176
  }
177
177
 
178
178
  });
179
179
 
180
- test("changing fromObject should mark binding as dirty", function() {
181
- fromObject.set("value", "change") ;
180
+ test("changing fromObject should mark binding as dirty", function () {
181
+ fromObject.set("value", "change");
182
182
  ok(SC.Binding._changeQueue.contains(binding), "the binding should be in the _changeQueue");
183
183
  });
184
184
 
185
- test("fromObject change should propogate after flush", function() {
186
- fromObject.set("value", "change") ;
187
- equals(toObject.get("value"), "start") ;
188
- SC.Binding.flushPendingChanges() ;
189
- equals(toObject.get("value"), "change") ;
185
+ test("fromObject change should propogate after flush", function () {
186
+ fromObject.set("value", "change");
187
+ equals(toObject.get("value"), "start");
188
+ SC.Binding.flushPendingChanges();
189
+ equals(toObject.get("value"), "change");
190
190
  });
191
191
 
192
- test("changing toObject should not make binding dirty", function() {
193
- toObject.set("value", "change") ;
192
+ test("changing toObject should not make binding dirty", function () {
193
+ toObject.set("value", "change");
194
194
  ok(!SC.Binding._changeQueue.contains(binding), "the binding should not be in the _changeQueue");
195
195
  });
196
196
 
197
- test("toObject change should NOT propogate", function() {
198
- toObject.set("value", "change") ;
199
- equals(fromObject.get("value"), "start") ;
200
- SC.Binding.flushPendingChanges() ;
201
- equals(fromObject.get("value"), "start") ;
197
+ test("toObject change should NOT propogate", function () {
198
+ toObject.set("value", "change");
199
+ equals(fromObject.get("value"), "start");
200
+ SC.Binding.flushPendingChanges();
201
+ equals(fromObject.get("value"), "start");
202
202
  });
203
203
 
204
- var first, second, third, binding1, binding2 ; // global variables
205
-
206
204
  module("chained binding", {
207
205
 
208
- setup: function() {
209
- first = SC.Object.create({ output: 'first' }) ;
206
+ setup: function () {
207
+ first = SC.Object.create({ output: 'first' });
210
208
 
211
209
  second = SC.Object.create({
212
210
  input: 'second',
213
211
  output: 'second',
214
212
 
215
- inputDidChange: function() {
216
- this.set("output", this.get("input")) ;
213
+ inputDidChange: function () {
214
+ this.set("output", this.get("input"));
217
215
  }.observes("input")
218
- }) ;
216
+ });
219
217
 
220
- third = SC.Object.create({ input: "third" }) ;
218
+ third = SC.Object.create({ input: "third" });
221
219
 
222
- binding1 = SC.Binding.from("output", first).to("input", second).connect() ;
223
- binding2 = SC.Binding.from("output", second).to("input", third).connect() ;
224
- SC.Binding.flushPendingChanges() ; // actually sets up up the connection
220
+ binding1 = SC.Binding.from("output", first).to("input", second).connect();
221
+ binding2 = SC.Binding.from("output", second).to("input", third).connect();
222
+ SC.Binding.flushPendingChanges(); // actually sets up up the connection
225
223
  }
226
224
 
227
225
  });
228
226
 
229
- test("changing first output should propagate to third after flush", function() {
230
- first.set("output", "change") ;
231
- equals("change", first.get("output"), "first.output") ;
232
- ok("change" !== third.get("input"), "third.input") ;
227
+ test("changing first output should propagate to third after flush", function () {
228
+ first.set("output", "change");
229
+ equals("change", first.get("output"), "first.output");
230
+ ok("change" !== third.get("input"), "third.input");
233
231
 
234
232
  var didChange = YES;
235
- while(didChange) didChange = SC.Binding.flushPendingChanges() ;
233
+ while (didChange) { didChange = SC.Binding.flushPendingChanges(); }
236
234
 
237
235
  // bindings should not have bending changes
238
236
  ok(!SC.Binding._changeQueue.contains(binding1), "the binding should not be in the _changeQueue");
239
237
  ok(!SC.Binding._changeQueue.contains(binding2), "the binding should not be in the _changeQueue");
240
238
 
241
- equals("change", first.get("output"), "first.output") ;
242
- equals("change", second.get("input"), "second.input") ;
243
- equals("change", second.get("output"), "second.output") ;
244
- equals("change", third.get("input"), "third.input") ;
239
+ equals("change", first.get("output"), "first.output");
240
+ equals("change", second.get("input"), "second.input");
241
+ equals("change", second.get("output"), "second.output");
242
+ equals("change", third.get("input"), "third.input");
245
243
  });
246
244
 
247
245
  module("Custom Binding", {
248
246
 
249
- setup: function() {
250
- Bon1 = SC.Object.extend({
251
- value1: "hi",
252
- value2: 83,
253
- array1: []
254
- });
247
+ setup: function () {
248
+ Bon1 = SC.Object.extend({
249
+ value1: "hi",
250
+ value2: 83,
251
+ array1: []
252
+ });
255
253
 
256
- bon2 = SC.Object.create({
257
- val1: "hello",
258
- val2: 25,
259
- arr: [1,2,3,4]
260
- });
254
+ bon2 = SC.Object.create({
255
+ val1: "hello",
256
+ val2: 25,
257
+ arr: [1, 2, 3, 4]
258
+ });
261
259
 
262
- TestNamespace = {
260
+ window.TestNamespace = {
263
261
  bon2: bon2,
264
262
  Bon1: Bon1
265
- } ;
263
+ };
266
264
  },
267
265
 
268
- teardown: function() {
266
+ teardown: function () {
269
267
  bon2.destroy();
270
268
  }
271
269
  });
272
270
 
273
- test("Binding value1 such that it will receive only single values", function() {
274
- var bon1 = Bon1.create({
275
- value1Binding: SC.Binding.single("TestNamespace.bon2.val1"),
276
- array1Binding: SC.Binding.single("TestNamespace.bon2.arr")
277
- });
278
- SC.Binding.flushPendingChanges();
279
- var a = [23,31,12,21];
280
- bon2.set("arr", a);
281
- bon2.set("val1","changed");
282
- SC.Binding.flushPendingChanges();
283
- equals(bon2.get("val1"),bon1.get("value1"));
284
- equals("@@MULT@@",bon1.get("array1"));
285
- bon1.destroy();
286
- });
287
-
288
- test("Single binding using notEmpty function.", function() {
289
- var bond = Bon1.create ({
290
- array1Binding: SC.Binding.single("TestNamespace.bon2.arr").notEmpty(null,'(EMPTY)')
291
- });
292
- SC.Binding.flushPendingChanges();
293
- bon2.set("arr", []);
294
- SC.Binding.flushPendingChanges();
295
- equals("(EMPTY)",bond.get("array1"));
296
- });
297
-
298
- test("Binding with transforms, function to check the type of value", function() {
299
- var jon = Bon1.create({
300
- value1Binding: SC.Binding.transform(function(val1) {
301
- return (SC.typeOf(val1) == SC.T_STRING)? val1 : "";
302
- }).from("TestNamespace.bon2.val1")
303
- });
304
- SC.Binding.flushPendingChanges();
305
- bon2.set("val1","changed");
306
- SC.Binding.flushPendingChanges();
307
- equals(jon.get("value1"), bon2.get("val1"));
308
- });
309
-
310
- test("two bindings to the same value should sync in the order they are initialized", function() {
271
+ test("Binding value1 such that it will receive only single values", function () {
272
+ var bon1 = Bon1.create({
273
+ value1Binding: SC.Binding.single("TestNamespace.bon2.val1"),
274
+ array1Binding: SC.Binding.single("TestNamespace.bon2.arr")
275
+ });
276
+ SC.Binding.flushPendingChanges();
277
+ var a = [23, 31, 12, 21];
278
+ bon2.set("arr", a);
279
+ bon2.set("val1", "changed");
280
+ SC.Binding.flushPendingChanges();
281
+ equals(bon2.get("val1"), bon1.get("value1"));
282
+ equals("@@MULT@@", bon1.get("array1"));
283
+ bon1.destroy();
284
+ });
285
+
286
+ test("Single binding using notEmpty function.", function () {
287
+ var bond = Bon1.create({
288
+ array1Binding: SC.Binding.single("TestNamespace.bon2.arr").notEmpty(null, '(EMPTY)')
289
+ });
290
+ SC.Binding.flushPendingChanges();
291
+ bon2.set("arr", []);
292
+ SC.Binding.flushPendingChanges();
293
+ equals("(EMPTY)", bond.get("array1"));
294
+ });
295
+
296
+ test("Binding with transforms, function to check the type of value", function () {
297
+ var jon = Bon1.create({
298
+ value1Binding: SC.Binding.transform(function (val1) {
299
+ return (SC.typeOf(val1) == SC.T_STRING) ? val1 : "";
300
+ }).from("TestNamespace.bon2.val1")
301
+ });
302
+ SC.Binding.flushPendingChanges();
303
+ bon2.set("val1", "changed");
304
+ SC.Binding.flushPendingChanges();
305
+ equals(jon.get("value1"), bon2.get("val1"));
306
+ });
307
+
308
+ test("Adding transform does not affect parent binding", function () {
309
+ var A,
310
+ a,
311
+ b;
312
+
313
+ A = SC.Object.extend({
314
+ isEnabledBindingDefault: SC.Binding.oneWay().bool()
315
+ });
316
+
317
+ b = SC.Object.create({
318
+ isEnabled: YES
319
+ });
320
+
321
+ a = A.create();
322
+ a.bind('isEnabled', b, 'isEnabled').not();
323
+
324
+ ok(A.prototype.isEnabledBindingDefault._transforms !== a.bindings[0]._transforms, "transforms array not shared with parent binding");
325
+ });
326
+
327
+ test("two bindings to the same value should sync in the order they are initialized", function () {
311
328
 
312
329
  SC.LOG_BINDINGS = YES;
313
330
 
@@ -328,7 +345,7 @@ test("two bindings to the same value should sync in the order they are initializ
328
345
  fooBinding: "*owner.foo"
329
346
  }),
330
347
 
331
- init: function() {
348
+ init: function () {
332
349
  sc_super();
333
350
  this.set('c', this.C.create({ owner: this }));
334
351
  }
@@ -345,13 +362,13 @@ test("two bindings to the same value should sync in the order they are initializ
345
362
  equals(b.get('foo'), "bar", 'a.foo should propogate up to b.foo');
346
363
  equals(b.c.get('foo'), "bar", 'a.foo should propogate up to b.c.foo');
347
364
 
348
- window.a = window.b = null ;
365
+ window.a = window.b = null;
349
366
 
350
367
  });
351
368
 
352
369
  module("AND binding", {
353
370
 
354
- setup: function() {
371
+ setup: function () {
355
372
  // temporarily set up two source objects in the SC namespace so we can
356
373
  // use property paths to access them
357
374
  SC.testControllerA = SC.Object.create({ value: NO });
@@ -363,14 +380,14 @@ module("AND binding", {
363
380
  });
364
381
  },
365
382
 
366
- teardown: function() {
383
+ teardown: function () {
367
384
  SC.testControllerA.destroy();
368
385
  SC.testControllerB.destroy();
369
386
  }
370
387
 
371
388
  });
372
389
 
373
- test("toObject.value should be YES if both sources are YES", function() {
390
+ test("toObject.value should be YES if both sources are YES", function () {
374
391
  SC.RunLoop.begin();
375
392
  SC.testControllerA.set('value', YES);
376
393
  SC.testControllerB.set('value', YES);
@@ -380,7 +397,7 @@ test("toObject.value should be YES if both sources are YES", function() {
380
397
  equals(toObject.get('value'), YES);
381
398
  });
382
399
 
383
- test("toObject.value should be NO if either source is NO", function() {
400
+ test("toObject.value should be NO if either source is NO", function () {
384
401
  SC.RunLoop.begin();
385
402
  SC.testControllerA.set('value', YES);
386
403
  SC.testControllerB.set('value', NO);
@@ -408,7 +425,7 @@ test("toObject.value should be NO if either source is NO", function() {
408
425
 
409
426
  module("OR binding", {
410
427
 
411
- setup: function() {
428
+ setup: function () {
412
429
  // temporarily set up two source objects in the SC namespace so we can
413
430
  // use property paths to access them
414
431
  SC.testControllerA = SC.Object.create({ value: NO });
@@ -420,14 +437,14 @@ module("OR binding", {
420
437
  });
421
438
  },
422
439
 
423
- teardown: function() {
440
+ teardown: function () {
424
441
  SC.testControllerA.destroy();
425
442
  SC.testControllerB.destroy();
426
443
  }
427
444
 
428
445
  });
429
446
 
430
- test("toObject.value should be first value if first value is truthy", function() {
447
+ test("toObject.value should be first value if first value is truthy", function () {
431
448
  SC.RunLoop.begin();
432
449
  SC.testControllerA.set('value', 'first value');
433
450
  SC.testControllerB.set('value', 'second value');
@@ -437,7 +454,7 @@ test("toObject.value should be first value if first value is truthy", function()
437
454
  equals(toObject.get('value'), 'first value');
438
455
  });
439
456
 
440
- test("toObject.value should be second value if first is falsy", function() {
457
+ test("toObject.value should be second value if first is falsy", function () {
441
458
  SC.RunLoop.begin();
442
459
  SC.testControllerA.set('value', NO);
443
460
  SC.testControllerB.set('value', 'second value');
@@ -448,16 +465,16 @@ test("toObject.value should be second value if first is falsy", function() {
448
465
  });
449
466
 
450
467
  module("Binding with '[]'", {
451
- setup: function() {
468
+ setup: function () {
452
469
  fromObject = SC.Object.create({ value: [] });
453
470
  toObject = SC.Object.create({ value: '' });
454
- binding = SC.Binding.transform(function(v) {
471
+ binding = SC.Binding.transform(function (v) {
455
472
  return v ? v.join(',') : '';
456
473
  }).from("value.[]", fromObject).to("value", toObject).connect();
457
474
  }
458
475
  });
459
476
 
460
- test("Binding refreshes after a couple of items have been pushed in the array", function() {
477
+ test("Binding refreshes after a couple of items have been pushed in the array", function () {
461
478
  fromObject.get('value').pushObjects(['foo', 'bar']);
462
479
  SC.Binding.flushPendingChanges();
463
480
  equals(toObject.get('value'), 'foo,bar');
@@ -465,7 +482,7 @@ test("Binding refreshes after a couple of items have been pushed in the array",
465
482
 
466
483
 
467
484
  module("propertyNameBinding with longhand", {
468
- setup: function(){
485
+ setup: function () {
469
486
  TestNamespace = {
470
487
  fromObject: SC.Object.create({
471
488
  value: "originalValue"
@@ -477,7 +494,7 @@ module("propertyNameBinding with longhand", {
477
494
  })
478
495
  };
479
496
  },
480
- teardown: function(){
497
+ teardown: function () {
481
498
  TestNamespace.fromObject.destroy();
482
499
  TestNamespace.toObject.destroy();
483
500
  delete TestNamespace.fromObject;
@@ -485,7 +502,7 @@ module("propertyNameBinding with longhand", {
485
502
  }
486
503
  });
487
504
 
488
- test("works with full path", function(){
505
+ test("works with full path", function () {
489
506
  SC.RunLoop.begin();
490
507
  TestNamespace.fromObject.set('value', "updatedValue");
491
508
  SC.RunLoop.end();
@@ -499,7 +516,7 @@ test("works with full path", function(){
499
516
  equals(TestNamespace.toObject.get('value'), "newerValue");
500
517
  });
501
518
 
502
- test("works with local path", function(){
519
+ test("works with local path", function () {
503
520
  SC.RunLoop.begin();
504
521
  TestNamespace.toObject.set('localValue', "updatedValue");
505
522
  SC.RunLoop.end();