Sha256: 9fea20e73f38648c0d4310bf0c548d5a7d92e92a823824d175452ea82241caa2
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 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 */ // test parsing of query string var rec, q; module("SC.Query comparison of record types", { setup: function() { // 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(); } }); test("should handle record types", function() { q.conditions = "TYPE_IS 'MyApp.Foo'"; q.parseQuery(); 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.parseQuery(); ok(!q.contains(rec), 'record with wrong type should not match'); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sproutit-sproutcore-1.0.20090721145285 | frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js |