Skip to content

Instantly share code, notes, and snippets.

@tim-evans
Created March 3, 2011 21:43
Show Gist options
  • Save tim-evans/853667 to your computer and use it in GitHub Desktop.
Save tim-evans/853667 to your computer and use it in GitHub Desktop.
Test for SC.RecordAttribute Date transform
MyApp = window.MyApp = {};
MyApp.store = SC.Store.create();
MyApp.Message = SC.Record.extend({
init: function () {
this.normalize();
return sc_super();
},
to: SC.Record.attr(String),
from: SC.Record.attr(String),
timestamp: SC.Record.attr(Date),
text: SC.Record.attr(String)
});
test("verify Data attributes marshal non-value values (undefined / null)", function () {
var message = MyApp.store.createRecord(MyApp.Message, {
guid: 'chocolate-moose',
to: 'swedish.chef@muppets.com',
from: 'moose@muppets.com',
text: 'Bork bork bork!'
});
ok(SC.none(message.get('timestamp')));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment