Skip to content

Commit

Permalink
Add test for canjs#1309 Model static properties not being overwritten…
Browse files Browse the repository at this point in the history
… when resource is set.
  • Loading branch information
daffl committed Nov 7, 2014
1 parent 8fc8a9d commit a527ca7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions model/model_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1637,4 +1637,29 @@ steal("can/model", 'can/map/attributes', "can/test", "can/util/fixture", functio
equal(count, 1, "findAll called only once.");
});

test("static methods do not get overwritten with resource property set (#1309)", function() {
var Base = can.Model.extend({
resource: '/path',
findOne: function() {
var dfd = can.Deferred();
dfd.resolve({
text: 'Base findAll'
});
return dfd;
}
}, {});

stop();

Base.findOne({}).then(function(model) {
ok(model instanceof Base);
deepEqual(model.attr(), {
text: 'Base findAll'
});
start();
}, function() {
ok(false, 'Failed handler should not be called.');
});
});

});

0 comments on commit a527ca7

Please sign in to comment.