element value is not cleared when value valor change to undefined

This commit is contained in:
Fabiano Taioli 2018-02-07 17:46:39 +01:00 committed by Pierre-Yves Gérardy
parent 33ff439c73
commit 83884bdc90
3 changed files with 15 additions and 0 deletions

View file

@ -59,6 +59,16 @@ o.spec("form inputs", function() {
o(updated.dom.value).equals("aaa")
})
o("clear element value if vdom value is set to undefined (aka removed)", function() {
var input = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}
var updated = {tag: "input", attrs: {value: undefined, oninput: function() {}}}
render(root, [input])
render(root, [updated])
o(updated.dom.value).equals("")
})
o("syncs input checked attribute if DOM value differs from vdom value", function() {
var input = {tag: "input", attrs: {type: "checkbox", checked: true, onclick: function() {}}}
var updated = {tag: "input", attrs: {type: "checkbox", checked: true, onclick: function() {}}}