Comparing version 3.6.0 to 3.6.1
@@ -515,1 +515,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); | ||
}); |
@@ -527,3 +527,7 @@ /* jshint -W079 */ | ||
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. | ||
@@ -530,0 +534,0 @@ } else if (curVal !== newVal) { |
@@ -1,2 +0,2 @@ | ||
/*can-map@3.4.2#bubble*/ | ||
/*can-map@3.6.0#bubble*/ | ||
define([ | ||
@@ -3,0 +3,0 @@ 'require', |
@@ -1,2 +0,2 @@ | ||
/*can-map@3.4.2#can-map*/ | ||
/*can-map@3.6.0#can-map*/ | ||
define([ | ||
@@ -282,3 +282,7 @@ 'require', | ||
if (types.isMapLike(curVal) && mapHelpers.canMakeObserve(newVal)) { | ||
curVal.attr(newVal, remove); | ||
if (remove === true) { | ||
canReflect.updateDeep(curVal, newVal); | ||
} else { | ||
canReflect.assignDeep(curVal, newVal); | ||
} | ||
} else if (curVal !== newVal) { | ||
@@ -285,0 +289,0 @@ self.__set(prop, self.__type(newVal, prop), curVal); |
@@ -1,2 +0,2 @@ | ||
/*can-map@3.4.2#map-helpers*/ | ||
/*can-map@3.6.0#map-helpers*/ | ||
define([ | ||
@@ -3,0 +3,0 @@ 'require', |
{ | ||
"name": "can-map", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "Observable Objects", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
Sorry, the diff of this file is too big to display
335855
8250