Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created November 29, 2011 13:39
Show Gist options
  • Save zubairov/1404830 to your computer and use it in GitHub Desktop.
Save zubairov/1404830 to your computer and use it in GitHub Desktop.
Defaults are not inherited in backbone.js
suite('Bug', function() {
suite('Backbone.js basic functionality', function() {
test('Defaults are inherited', function() {
var One = Backbone.Model.extend({
defaults : {
children : []
}
});
var Two = One.extend();
var Three = One.extend({
defaults: {
fubar : 'value'
}
});
assert.ok((new One).has('children'), 'One has no children');
assert.ok((new Two).has('children'), 'Two has no children');
assert.ok((new Three).has('fubar'), 'Three has no fubar');
assert.ok((new Three).has('children'), 'Three has no children');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment