sproutcore 1.0.1043 → 1.0.1046

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.
data/Rakefile CHANGED
@@ -189,7 +189,7 @@ namespace :release do
189
189
  task :gemcutter => [:prepare, 'gemcutter:release']
190
190
 
191
191
  desc "one release to rule them all"
192
- task :all => [:prepare, 'release:gemcutter', 'release:rubyforge']
192
+ task :all => [:prepare, 'release:gemcutter']
193
193
 
194
194
  end
195
195
 
@@ -1,7 +1,7 @@
1
1
  ---
2
- :digest: 27241da4db9a4fd342f444b171b497ccb7272fe0
2
+ :digest: 991afd0db6e66c3e4067d9ad4c2bd6a105eeba97
3
3
  :dist:
4
- frameworks/sproutcore: e9b957ac68b9adc9eb9cef27396eea85f3075553
4
+ frameworks/sproutcore: e3bbb4a88ae2bc9fa217d0cf5a24868683f6ae91
5
5
  :major: 1
6
6
  :minor: 0
7
- :patch: 1043
7
+ :patch: 1046
@@ -531,6 +531,12 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
531
531
 
532
532
  // only resort and update if we did change
533
533
  if (didChange) {
534
+
535
+ // storeKeys must be a new instance because orderStoreKeys() works on it
536
+ if (storeKeys && (storeKeys===oldStoreKeys)) {
537
+ storeKeys = storeKeys.copy();
538
+ }
539
+
534
540
  storeKeys = SC.Query.orderStoreKeys(storeKeys, query, store);
535
541
  if (SC.compare(oldStoreKeys, storeKeys) !== 0){
536
542
  this.set('storeKeys', SC.clone(storeKeys)); // replace content
@@ -1711,7 +1711,7 @@ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
1711
1711
  */
1712
1712
  loadRecord: function(recordType, dataHash, id) {
1713
1713
  var K = SC.Record,
1714
- ret, primaryKey, dataHash, storeKey;
1714
+ ret, primaryKey, storeKey;
1715
1715
 
1716
1716
  // save lookup info
1717
1717
  recordType = recordType || SC.Record;
@@ -129,6 +129,49 @@ test("calling storeDidChangeStoreKeys() to remove a record", function() {
129
129
  });
130
130
 
131
131
 
132
+ // ..........................................................
133
+ // SPECIAL CASES
134
+ //
135
+
136
+ var json2, foo, bar ;
137
+
138
+ module("SC.RecordArray core methods", {
139
+ setup: function() {
140
+ // setup dummy store
141
+ store = SC.Store.create();
142
+
143
+ storeKey = SC.Record.storeKeyFor('foo');
144
+ json = { guid: "foo", name: "foo" };
145
+ store.writeDataHash(storeKey, json, SC.Record.READY_CLEAN);
146
+ foo = store.materializeRecord(storeKey);
147
+ equals(foo.get('name'), 'foo', 'record should have json');
148
+
149
+ storeKey = SC.Record.storeKeyFor('bar');
150
+ json2 = { guid: "bar", name: "bar" };
151
+ store.writeDataHash(storeKey, json2, SC.Record.READY_CLEAN);
152
+ bar = store.materializeRecord(storeKey);
153
+ equals(bar.get('name'), 'bar', 'record should have json');
154
+
155
+ // get record array.
156
+ query = SC.Query.create({ recordType: SC.Record, orderBy: 'name' });
157
+ recs = store.find(query);
158
+ }
159
+ });
160
+
161
+ test("local query should notify changes", function() {
162
+
163
+ // note: important to retrieve records from RecordArray first to prime
164
+ // any cache
165
+ same(recs.mapProperty('id'), ['bar', 'foo'], 'PRECOND - bar should appear before foo');
166
+
167
+ SC.stopIt = YES;
168
+
169
+ SC.RunLoop.begin();
170
+ bar.set('name', 'zzbar');
171
+ SC.RunLoop.end(); // should resort record array
172
+
173
+ same(recs.mapProperty('id'), ['foo', 'bar'], 'order of records should change');
174
+ });
132
175
 
133
176
 
134
177
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sproutcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1043
4
+ version: 1.0.1046
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sprout Systems, Inc. Apple Inc. and contributors
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-16 00:00:00 -08:00
12
+ date: 2010-01-19 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency