Sha256: 5f35b007fda65570bf891c8c83f480b6992ae5f840869c8555fd341a37d2ca23

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

var store, TestRecord;

module("SC.Store#unloadRecords", {
  setup: function() {
    TestRecord = SC.Record.extend({
      name: SC.Record.attr(String)
    });

    SC.RunLoop.begin();

    store = SC.Store.create();

    store.createRecord(TestRecord, {
      name: 'Foo'
    });

    store.createRecord(TestRecord, {
      name: 'Bar'
    });

    store.createRecord(TestRecord, {
      name: 'Baz'
    });

    SC.RunLoop.end();
  }
});

test("Unload all records of a record type", function() {
  var records = store.find(TestRecord);
  equals(records.get('length'), 3, "Store starts with 3 records loaded");
  store.unloadRecords(TestRecord);
  records = store.find(TestRecord);
  equals(records.get('length'), 0, "Number of TestRecord records left");
});

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js