From 4182faee09d5286cec862ef77015b4237f308b3a Mon Sep 17 00:00:00 2001 From: Manuel Mujica Date: Tue, 27 Feb 2018 17:19:13 -0700 Subject: [PATCH] Use prototype properties as defaults Closes #91 --- can-map.js | 6 ++---- can-map_test.js | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/can-map.js b/can-map.js index 712263a..89e43a9 100644 --- a/can-map.js +++ b/can-map.js @@ -101,10 +101,8 @@ var Map = Construct.extend( if ( prop !== "define" && prop !== "constructor" && - ( - typeof this.prototype[prop] !== "function" && !canReflect.isValueLike(this.prototype[prop]) || - this.prototype[prop].prototype instanceof Construct - ) + (typeof this.prototype[prop] !== "function" || + this.prototype[prop].prototype instanceof Construct) ) { this.defaults[prop] = this.prototype[prop]; } else if (canReflect.isObservableLike(this.prototype[prop])) { diff --git a/can-map_test.js b/can-map_test.js index b2321fa..95908a0 100644 --- a/can-map_test.js +++ b/can-map_test.js @@ -492,3 +492,9 @@ QUnit.test("can.isBound", function(){ var p = new Person(); QUnit.ok(! p[canSymbol.for("can.isBound")](), "not bound"); }); + +QUnit.test("prototype properties", function(assert) { + var MyMap = Map.extend({ letters: "ABC" }); + var map = new MyMap(); + assert.equal(map.attr("letters"), "ABC"); +});