mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-08 03:00:26 -04:00
Add a test case for cloning the attribute object
The problem is that the attribute object isn't cloned so when an ID is set through the constructor attributes[id] will get set on all subsequent objects as well.
This commit is contained in:
@@ -214,4 +214,11 @@ $(document).ready(function() {
|
||||
b.trigger('click');
|
||||
});
|
||||
|
||||
test("Clone attributes object", function() {
|
||||
var View = Backbone.View.extend({attributes: {foo: 'bar'}});
|
||||
var v1 = new View({id: 'foo'});
|
||||
ok(v1.el.id === 'foo');
|
||||
var v2 = new View();
|
||||
ok(!v2.el.id);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user