Comparing version 4.3.0 to 4.3.1
@@ -598,1 +598,35 @@ /* jshint asi:true */ | ||
}); | ||
QUnit.test("Can assign nested properties that are not CanMaps", function(){ | ||
var MyType = function() { | ||
this.one = 'one'; | ||
this.two = 'two'; | ||
this.three = 'three'; | ||
}; | ||
MyType.prototype[canSymbol.for("can.onKeyValue")] = function(){}; | ||
MyType.prototype[canSymbol.for("can.isMapLike")] = true; | ||
var map = new Map({ | ||
_legacyAttrBehavior: true, | ||
foo: 'bar', | ||
prop: new MyType() | ||
}); | ||
map.attr({ | ||
prop: {one: '1', two: '2'} | ||
}); | ||
// Did an assign | ||
QUnit.equal(map.attr("prop.one"), "1"); | ||
QUnit.equal(map.attr("prop.two"), "2"); | ||
QUnit.equal(map.attr("prop.three"), "three"); | ||
// An update | ||
map.attr({ | ||
prop: {one: 'one', two: 'two'} | ||
}, true); | ||
QUnit.equal(map.attr("prop.one"), "one"); | ||
QUnit.equal(map.attr("prop.two"), "two"); | ||
QUnit.equal(map.attr("prop.three"), undefined); | ||
}); |
@@ -538,3 +538,7 @@ "use strict"; | ||
if ( types.isMapLike(curVal) && mapHelpers.canMakeObserve(newVal) ) { | ||
curVal.attr(newVal, remove); | ||
if(remove === true) { | ||
canReflect.updateDeep(curVal, newVal); | ||
} else { | ||
canReflect.assignDeep(curVal, newVal); | ||
} | ||
// Otherwise just set. | ||
@@ -541,0 +545,0 @@ } else if (curVal !== newVal) { |
{ | ||
"name": "can-map", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "Observable Objects", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
82890
1661