[#25,model][xs]: remove artificial field attribute (follow up to penultimate commit cf42e43ff0f32ba24e940455b060ae278025942b).

This commit is contained in:
Rufus Pollock 2012-02-18 07:48:14 +00:00
parent 0364f3e847
commit 2da6c1a297
2 changed files with 2 additions and 0 deletions

View File

@ -97,6 +97,7 @@ my.Field = Backbone.Model.extend({
// if a hash not passed in the first argument is set as value for key 0
if ('0' in data) {
this.set({id: data['0']});
this.unset('0');
}
if (this.attributes.label == null) {
this.set({label: this.id});

View File

@ -16,6 +16,7 @@ test('Field: basics', function () {
var field = new recline.Model.Field('x');
equal(field.id, 'x', 'Set of id from single argumentst to ctor');
equal(field.attributes.id, 'x', 'Set of id from single argumentst to ctor');
ok(!('0' in field.toJSON()), 'Should have removed artificially created 0 key in attributes');
});
})(this.jQuery);