Skip to content

Commit 14d05c2

Browse files
committed
can.Model.model doesn't use custom id for store
1 parent 234fd3b commit 14d05c2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

model/model_test.js

+20
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,26 @@ test("models", function(){
176176
equals(people[0].prettyName(),"Mr. Justin","wraps wrapping works")
177177
});
178178

179+
test(".model with custom id", function() {
180+
can.Model("CustomId", {
181+
id : '_id'
182+
}, {
183+
getName : function() {
184+
return this.name;
185+
}
186+
});
187+
var test = CustomId.model({
188+
_id : 1,
189+
name : 'Justin'
190+
});
191+
equal(test.getName(), 'Justin', 'Wrapping works and name set properly');
192+
var test2 = CustomId.model({
193+
_id : 2,
194+
name : 'Brian'
195+
});
196+
equal(test.getName(), 'Brian', 'Warapped and name set');
197+
});
198+
179199

180200
/*
181201
test("async setters", function(){

0 commit comments

Comments
 (0)