Adjust tests, fix typo

This commit is contained in:
Francisco Hodge 2020-10-20 21:09:49 -04:00
parent 9778be02a9
commit b4b9d83569
2 changed files with 37 additions and 2 deletions

View File

@ -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 ||

View File

@ -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",