Sha256: e2ae93713392cf7ba976d0bbf7e0d1d632f4a195924ad6200fb58b89ce7f79b2
Contents?: true
Size: 1.51 KB
Versions: 11
Compression:
Stored size: 1.51 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 */ var MyFoo = null ; module("SC.Record#unknownProperty", { setup: function() { MyApp = SC.Object.create({ store: SC.Store.create() }) ; MyApp.Foo = SC.Record.extend(); MyApp.json = { foo: "bar", number: 123, bool: YES, array: [1,2,3] }; MyApp.foo = MyApp.store.createRecord(MyApp.Foo, MyApp.json); } }); test("get() returns attributes with no type changes if they exist", function() { 'foo number bool array'.w().forEach(function(key) { equals(MyApp.foo.get(key), MyApp.json[key], "MyApp.foo.get(%@) should === attribute".fmt(key)); }); }); test("get() unknown attribute returns undefined", function() { equals(MyApp.foo.get('imaginary'), undefined, 'imaginary property should be undefined'); }); test("set() unknown property should add to dataHash", function() { MyApp.foo.set('blue', '0x00f'); equals(MyApp.store.dataHashes[MyApp.foo.storeKey].blue, '0x00f', 'should add blue attribute'); }); test("set() should replace existing property", function() { MyApp.foo.set('foo', 'baz'); equals(MyApp.store.dataHashes[MyApp.foo.storeKey].foo, 'baz', 'should update foo attribute'); });
Version data entries
11 entries across 11 versions & 1 rubygems