fix: Allow for changing focus in lifecycle hooks (#1988)

This commit is contained in:
Mateusz Jaworski 2017-10-14 07:31:03 +02:00 committed by Pat Cavit
parent 77378af232
commit 8b56c70911
3 changed files with 12 additions and 1 deletions

View file

@ -30,6 +30,16 @@ o.spec("form inputs", function() {
o($window.document.activeElement).equals(input.dom)
})
o("maintains focus when changed manually in hook", function() {
var input = {tag: "input", attrs: {oncreate: function() {
input.dom.focus();
}}};
render(root, [input])
o($window.document.activeElement).equals(input.dom)
})
o("syncs input value if DOM value differs from vdom value", function() {
var input = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}
var updated = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}