Sha256: 05ed2cd26a21c3e6a6c0ed69bb7defd1df86f373e91c92fba90a64a3c80a8862

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 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 & 1 rubygems

Version Path
sproutcore-1.5.0.rc.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js
sproutcore-1.5.0.rc.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js