mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-20 18:05:37 +08:00
Adjust tests, fix typo
This commit is contained in:
parent
9778be02a9
commit
b4b9d83569
@ -37,7 +37,7 @@ class PhysicalKeyboard {
|
|||||||
|
|
||||||
if (options.physicalKeyboardHighlightPress) {
|
if (options.physicalKeyboardHighlightPress) {
|
||||||
/**
|
/**
|
||||||
* Trigger mousedown
|
* Trigger pointerdown
|
||||||
*/
|
*/
|
||||||
(
|
(
|
||||||
buttonDOM.onpointerdown ||
|
buttonDOM.onpointerdown ||
|
||||||
@ -64,7 +64,7 @@ class PhysicalKeyboard {
|
|||||||
|
|
||||||
if (options.physicalKeyboardHighlightPress) {
|
if (options.physicalKeyboardHighlightPress) {
|
||||||
/**
|
/**
|
||||||
* Trigger mousedown
|
* Trigger pointerup
|
||||||
*/
|
*/
|
||||||
(
|
(
|
||||||
buttonDOM.onpointerup ||
|
buttonDOM.onpointerup ||
|
||||||
|
@ -167,3 +167,38 @@ it('PhysicalKeyboard will work with physicalKeyboardHighlightPress (touch)', ()
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('PhysicalKeyboard with physicalKeyboardHighlightPress can trigger noop', () => {
|
||||||
|
setDOM();
|
||||||
|
|
||||||
|
const keyboard = new Keyboard({
|
||||||
|
physicalKeyboardHighlight: true,
|
||||||
|
physicalKeyboardHighlightPress: true,
|
||||||
|
useTouchEvents: true,
|
||||||
|
debug: true
|
||||||
|
});
|
||||||
|
|
||||||
|
keyboard.getButtonElement('f').onmousedown = null;
|
||||||
|
keyboard.getButtonElement('f').onpointerdown = null;
|
||||||
|
keyboard.getButtonElement('f').ontouchstart = null;
|
||||||
|
|
||||||
|
document.dispatchEvent(new KeyboardEvent('keydown', {
|
||||||
|
code: "KeyF",
|
||||||
|
key: "f",
|
||||||
|
target: {
|
||||||
|
tagName: "input"
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
keyboard.getButtonElement('f').onmouseup = null;
|
||||||
|
keyboard.getButtonElement('f').onpointerup = null;
|
||||||
|
keyboard.getButtonElement('f').ontouchend = null;
|
||||||
|
|
||||||
|
document.dispatchEvent(new KeyboardEvent('keyup', {
|
||||||
|
code: "KeyF",
|
||||||
|
key: "f",
|
||||||
|
target: {
|
||||||
|
tagName: "input"
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user