mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-20 09:45: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) {
|
||||
/**
|
||||
* Trigger mousedown
|
||||
* Trigger pointerdown
|
||||
*/
|
||||
(
|
||||
buttonDOM.onpointerdown ||
|
||||
@ -64,7 +64,7 @@ class PhysicalKeyboard {
|
||||
|
||||
if (options.physicalKeyboardHighlightPress) {
|
||||
/**
|
||||
* Trigger mousedown
|
||||
* Trigger pointerup
|
||||
*/
|
||||
(
|
||||
buttonDOM.onpointerup ||
|
||||
|
@ -159,6 +159,41 @@ it('PhysicalKeyboard will work with physicalKeyboardHighlightPress (touch)', ()
|
||||
}
|
||||
}));
|
||||
|
||||
document.dispatchEvent(new KeyboardEvent('keyup', {
|
||||
code: "KeyF",
|
||||
key: "f",
|
||||
target: {
|
||||
tagName: "input"
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
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",
|
||||
|
Loading…
Reference in New Issue
Block a user