Implement first unit-tests #6

Merged
jacob1123 merged 9 commits from unit-tests into master 2022-02-09 23:41:08 +01:00
Showing only changes of commit 3bd5845068 - Show all commits

View File

@ -56,6 +56,12 @@ export default defineComponent({
if(e.key == "Enter") { if(e.key == "Enter") {
const selected = this.$data.Suggestions[0]; const selected = this.$data.Suggestions[0];
this.selectElement(selected); this.selectElement(selected);
const el = (<HTMLInputElement>e.target);
const inputElements = Array.from(el.ownerDocument.querySelectorAll('input:not([disabled]):not([readonly])'));
const currentIndex = inputElements.indexOf(el);
const nextElement = inputElements[currentIndex < inputElements.length - 1 ? currentIndex + 1 : 0];
(<HTMLInputElement>nextElement).focus();
} }
}, },
selectElement(element : Suggestion) { selectElement(element : Suggestion) {