Sha256: a2a4bed5598d3f4ad29387b7b537f0ad4b4b4dfeaaa77e099b18d177de333161

Contents?: true

Size: 1.36 KB

Versions: 41

Compression:

Stored size: 1.36 KB

Contents

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

// test parsing of query string
var rec, q;
module("SC.Query comparison of record types", {
  setup: function() {
    SC.RunLoop.begin();

    // setup dummy app and store
    window.MyApp = SC.Object.create({
      store: SC.Store.create()
    });
    
    // setup a dummy model
    window.MyApp.Foo = SC.Record.extend({});
    
    // load some data
    window.MyApp.store.loadRecords(window.MyApp.Foo, [
      { guid: 1, firstName: "John", lastName: "Doe" }
    ]);
    
    rec = window.MyApp.store.find(window.MyApp.Foo,1);
    
    q = SC.Query.create();

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


  
test("should handle record types", function() {
  
  q.conditions = "TYPE_IS 'MyApp.Foo'";
  q.parse();
  equals(SC.Store.recordTypeFor(rec.storeKey), SC.objectForPropertyPath('MyApp.Foo'), 'record type should be MyApp.Foo');
  ok(q.contains(rec), 'record with proper type should match');
  
  q.conditions = "TYPE_IS 'MyApp.Baz'";
  q.parse();
  ok(!q.contains(rec), 'record with wrong type should not match');
});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js