Fixed onChangeAll callback

This commit is contained in:
Francisco Hodge 2019-03-07 20:51:57 -05:00
parent 30941f4ba0
commit bd0274415b
2 changed files with 22 additions and 0 deletions

View File

@ -208,6 +208,12 @@ class SimpleKeyboard {
*/ */
if (typeof this.options.onChange === "function") if (typeof this.options.onChange === "function")
this.options.onChange(this.input[this.options.inputName]); this.options.onChange(this.input[this.options.inputName]);
/**
* Calling onChangeAll
*/
if (typeof this.options.onChangeAll === "function")
this.options.onChangeAll(this.input);
} }
if (debug) { if (debug) {

View File

@ -186,6 +186,22 @@ it('Keyboard onChange will work', () => {
expect(output).toBe("q"); expect(output).toBe("q");
}); });
it('Keyboard onChangeAll will work', () => {
testUtil.setDOM();
let output;
let keyboard = new Keyboard({
onChangeAll: (input) => {
output = input ? input.default : null;
}
});
keyboard.getButtonElement("q").onclick();
expect(output).toBe("q");
});
it('Keyboard clearInput will work', () => { it('Keyboard clearInput will work', () => {
testUtil.setDOM(); testUtil.setDOM();