Skip to content

Commit

Permalink
fixes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Dec 16, 2016
1 parent 23f5724 commit ace6dcd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions can-construct.js
Expand Up @@ -309,7 +309,7 @@ assign(Construct, {
// this should be used for patching other objects
// the super plugin overwrites this
_overwrite: function (what, oldProps, propName, val) {
what[propName] = val;
Object.defineProperty(what, propName, {value: val, configurable: true, enumerable: true, writable: true});
},
// Set `defaults` as the merger of the parent `defaults` and this
// object's `defaults`. If you overwrite this method, make sure to
Expand Down Expand Up @@ -685,7 +685,7 @@ assign(Construct, {
* return [$(element)]
* }
* });
*
*
* MyWidget = WidgetFactory.extend({
* init: function($el){
* $el.html("My Widget!!")
Expand Down
19 changes: 19 additions & 0 deletions can-construct_test.js
Expand Up @@ -206,3 +206,22 @@ test("basic injection attacks thwarted", function() {
}

});

QUnit.test("setters not invoked on extension (#28)", function(){

var extending = true;
var Base = Construct.extend("Base",{
set something(value){
QUnit.ok(!extending, "called when not extending");
},
get something(){

}
});

Base.extend("Extended",{
something: "value"
});
extending = false;
new Base().something = "foo";
});

0 comments on commit ace6dcd

Please sign in to comment.