mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-19 16:52:59 +08:00
Fixed onChangeAll callback
This commit is contained in:
parent
30941f4ba0
commit
bd0274415b
@ -208,6 +208,12 @@ class SimpleKeyboard {
|
||||
*/
|
||||
if (typeof this.options.onChange === "function")
|
||||
this.options.onChange(this.input[this.options.inputName]);
|
||||
|
||||
/**
|
||||
* Calling onChangeAll
|
||||
*/
|
||||
if (typeof this.options.onChangeAll === "function")
|
||||
this.options.onChangeAll(this.input);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
|
@ -186,6 +186,22 @@ it('Keyboard onChange will work', () => {
|
||||
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', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user