mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-20 01:22: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")
|
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) {
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user