Skip to content

Commit

Permalink
fixes a bug with properties not being able to be re-assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Jul 6, 2018
1 parent eb59245 commit 45628e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion can-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,8 @@ define.makeSimpleGetterSetter = function(prop){
set: function(newVal){
return setter.call(this, define.types.observable(newVal));
},
enumerable: true
enumerable: true,
configurable: true
};
}
return simpleGetterSetters[prop];
Expand Down
2 changes: 2 additions & 0 deletions define-helpers/define-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var defineHelpers = {
Object.defineProperty(map, "_instanceDefinitions", {
configurable: true,
enumerable: false,
writable: true,
value: {}
});
instanceDefines = map._instanceDefinitions;
Expand Down Expand Up @@ -139,6 +140,7 @@ var defineHelpers = {
var oldValue = this._data[prop];
if(oldValue !== undefined) {
delete this._data[prop];
delete this[prop];
this.dispatch({
type: prop,
target: this,
Expand Down
7 changes: 7 additions & 0 deletions map/map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,14 @@ QUnit.test("deleteKey works (#351)", function(){

map.deleteKey("foo");

var pd = Object.getOwnPropertyDescriptor(map, "foo");


QUnit.ok(!pd, "no property descriptor");

QUnit.deepEqual( canReflect.getOwnKeys(map), [] );

map.set("foo", "bar");
});

QUnit.test("type called with `this` as the map (#349)", function(){
Expand Down

0 comments on commit 45628e1

Please sign in to comment.