From a527ca76d9e47117a1c85c429c1a066d85cfa835 Mon Sep 17 00:00:00 2001 From: David Luecke Date: Fri, 7 Nov 2014 13:25:55 -0700 Subject: [PATCH] Add test for #1309 Model static properties not being overwritten when resource is set. --- model/model_test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/model/model_test.js b/model/model_test.js index 480fbe52824..69aba9232bf 100644 --- a/model/model_test.js +++ b/model/model_test.js @@ -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.'); + }); + }); + });