Skip to content

Commit

Permalink
Merge pull request canjs#1317 from bitovi/test-resource-overwrite-1309
Browse files Browse the repository at this point in the history
Add test for Model static properties not being overwritten when re...
  • Loading branch information
daffl committed Nov 7, 2014
2 parents 8fc8a9d + a527ca7 commit 7aa6456
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 7aa6456

Please sign in to comment.