Sha256: c45b7ebf89a56cf69b1b32732eb422cf07505e85093ed0976477b909bf2e824e

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 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() {
    SC.RunLoop.begin();
    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
    };
  },
  
  teardown: function() {
    SC.RunLoop.end();
  }
  
});

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

16 entries across 16 versions & 1 rubygems

Version Path
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js
sproutcore-1.0.1003 frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js