Sha256: 1fb5ca38a42e304d8a2a2f72e121b70eaddecc334c5af12a08656cb1fc2ff382

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple, Inc. and contributors.
// License:   Licened under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */

var MyFoo = null, callInfo ;
module("SC.Record#refresh", {
  setup: function() {
    MyApp = SC.Object.create({
      store: SC.Store.create()
    })  ;
  
    MyApp.Foo = SC.Record.extend();
    MyApp.json = { 
      foo: "bar", 
      number: 123,
      bool: YES,
      array: [1,2,3] 
    };
    
    MyApp.foo = MyApp.store.createRecord(MyApp.Foo, MyApp.json);
    
    // modify store so that everytime refreshRecords() is called it updates 
    // callInfo
    callInfo = null ;
    MyApp.store.refreshRecord = function(records) {
      callInfo = SC.A(arguments) ; // save method call
    };
  }
});

test("calling refresh should call refreshRecord() on store", function() {
  MyApp.foo.refresh();
  same(callInfo, [null,null,MyApp.foo.storeKey], 'refreshRecord() should be called on parent');
});

test("should return receiver", function() {
  equals(MyApp.foo.refresh(), MyApp.foo, 'should return receiver');
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js