Sha256: f91b422597f423372a31f3c82779f4e399f82952f11ac61b431c3d0ffb469465

Contents?: true

Size: 1.62 KB

Versions: 18

Compression:

Stored size: 1.62 KB

Contents

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

var store, Application;
module("SC.Record Error Methods", {
  setup: function() {

    Application = {};
    Application.Thing = SC.Record.extend({
      name: SC.Record.attr(String)
    });

    SC.RunLoop.begin();
    store = SC.Store.create();

    var records = [
      { guid: 1, name: 'Thing One' },
      { guid: 2, name: 'Thing Two' }
    ];

    var types = [ Application.Thing, Application.Thing ];

    store.loadRecords(types, records);
    SC.RunLoop.end();
  },

  teardown: function() {
    store = null;
    Application = null;
  }
});

test("Verify error methods behave correctly", function() {
  var thing1 = store.find(Application.Thing, 1);
  var storeKey = thing1.get('storeKey');

  var thing2 = store.find(Application.Thing, 2);

  SC.RunLoop.begin();
  store.writeStatus(storeKey, SC.Record.BUSY_LOADING);
  store.dataSourceDidError(storeKey, SC.Record.GENERIC_ERROR);
  SC.RunLoop.end();

  ok(thing1.get('isError'), "isError on thing1 should be YES");
  ok(!thing2.get('isError'), "isError on thing2 should be NO");

  equals(thing1.get('errorObject'), SC.Record.GENERIC_ERROR,
    "get('errorObject') on thing1 should return the correct error object");

  equals(thing2.get('errorObject'), null,
    "get('errorObject') on thing2 should return null");
});

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js