Skip to content

Commit

Permalink
fixes #457
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed May 28, 2018
1 parent 575fa31 commit 63cfcf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion can-stache-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ var getBindingInfo = function(node, attributeViewModelBindings, templateType, ta

if(dataBindingName) {
var childEventName = getEventName(result);
var initializeValues = childEventName ? false : true;
var initializeValues = childEventName && dataBindingName !== "bind" ? false : true;
bindingInfo = assign({
parent: scopeBindingStr,
child: getChildBindingStr(result.tokens, favorViewModel),
Expand Down
12 changes: 11 additions & 1 deletion test/colon/hybrid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,22 @@ testHelpers.makeTests("can-stache-bindings - colon - hybrids", function(name, do

QUnit.test("on:input:value:to does not initialize values (#289)", function() {
try {
stache("<input on:input:value:to='*editing.licensePlate'/>")();
stache("<input on:input:value:to='scope.vars.editing.licensePlate'/>")();
ok(true, "renderer was made without error");
}
catch(e) {
ok(false, e.message);
}
});

QUnit.test("on:input:value:bind should initialize values (#457)", function() {

var frag = stache("<input on:input:value:bind='foo'/>")({
foo: "bar"
});
var input = frag.firstChild;

QUnit.equal(input.value, "bar", "initialized to the parent value");
});

});

0 comments on commit 63cfcf4

Please sign in to comment.