can-stache-bindings
Advanced tools
Comparing version 4.10.1 to 4.10.2
@@ -18,3 +18,3 @@ "use strict"; | ||
var canViewModel = require('can-view-model'); | ||
var observeReader = require('can-stache-key'); | ||
var stacheKey = require('can-stache-key'); | ||
var ObservationRecorder = require('can-observation-recorder'); | ||
@@ -767,7 +767,7 @@ var SimpleObservable = require('can-simple-observable'); | ||
var isBoundToContext = vmName === "." || vmName === "this"; | ||
var keysToRead = isBoundToContext ? [] : observeReader.reads(vmName); | ||
var keysToRead = isBoundToContext ? [] : stacheKey.reads(vmName); | ||
function getViewModelProperty() { | ||
var viewModel = bindingContext.viewModel; | ||
return observeReader.read(viewModel, keysToRead, {}).value; | ||
return stacheKey.read(viewModel, keysToRead, {}).value; | ||
} | ||
@@ -806,3 +806,3 @@ //!steal-remove-start | ||
} else { | ||
canReflect.setKeyValue(viewModel, setName, newVal); | ||
stacheKey.write(viewModel, keysToRead, newVal); | ||
} | ||
@@ -809,0 +809,0 @@ } |
{ | ||
"name": "can-stache-bindings", | ||
"version": "4.10.1", | ||
"version": "4.10.2", | ||
"description": "Default binding syntaxes for can-stache", | ||
@@ -65,7 +65,7 @@ "homepage": "https://canjs.com/doc/can-stache-bindings.html", | ||
"jshint": "^2.9.1", | ||
"steal": "^1.2.9", | ||
"steal": "^2.2.1", | ||
"steal-qunit": "^1.0.1", | ||
"steal-tools": "^1.1.2", | ||
"testee": "^0.7.0" | ||
"steal-tools": "^2.2.1", | ||
"testee": "^0.9.0" | ||
} | ||
} |
@@ -824,2 +824,41 @@ var QUnit = require('steal-qunit'); | ||
}); | ||
QUnit.test("nested props with two way binding", function() { | ||
var nestedValue = new SimpleMap({ | ||
first: 'Matt' | ||
}); | ||
var childVM = new SimpleMap({ | ||
name: nestedValue | ||
}); | ||
MockComponent.extend({ | ||
tag: "my-child", | ||
viewModel: childVM, | ||
template: stache('<input value:bind="name.first" />') | ||
}); | ||
var parentVM = new SimpleMap({ | ||
name: 'Justin' | ||
}); | ||
MockComponent.extend({ | ||
tag: "my-parent", | ||
viewModel: parentVM, | ||
template: stache('<my-child name.first:bind="name" /><input value:bind="name" />') | ||
}); | ||
var template = stache("<my-parent />")(); | ||
var parentInput = template.childNodes.item(0).childNodes.item(1); | ||
var childInput = template.childNodes.item(0).childNodes.item(0).childNodes.item(0); | ||
parentInput.value = 'updated'; | ||
domEvents.dispatch(parentInput, 'change'); | ||
QUnit.equal(parentVM.get('name'), 'updated', 'parent vm has correct value'); | ||
QUnit.equal(nestedValue.get('first'), 'updated', 'child vm has correct value'); | ||
childInput.value = 'child-updated'; | ||
domEvents.dispatch(childInput, 'change'); | ||
QUnit.equal(parentVM.get('name'), 'child-updated', 'parent vm has correct value'); | ||
QUnit.equal(nestedValue.get('first'), 'child-updated', 'child vm has correct value'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
211845
4182
1