|
|
|
@ -324,8 +324,12 @@ describe('\n Hotkeys.js Test Case.\n', () => {
|
|
|
|
|
await __triggerKeyboardEvent(document.body, 65, {
|
|
|
|
|
shiftKey: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(callbackA.mock.calls.length).toBe(1);
|
|
|
|
|
/**
|
|
|
|
|
* https://github.com/jaywcjlove/hotkeys/issues/55
|
|
|
|
|
* 解决三键组合,实现键值比对,
|
|
|
|
|
* 并不是对象比对,此测试用例无法模拟
|
|
|
|
|
*/
|
|
|
|
|
expect(callbackA.mock.calls.length).toBe(0);
|
|
|
|
|
|
|
|
|
|
hotkeys.unbind('shift+a', callbackA);
|
|
|
|
|
|
|
|
|
@ -333,7 +337,7 @@ describe('\n Hotkeys.js Test Case.\n', () => {
|
|
|
|
|
shiftKey: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(callbackA.mock.calls.length).toBe(1);
|
|
|
|
|
expect(callbackA.mock.calls.length).toBe(0);
|
|
|
|
|
|
|
|
|
|
hotkeys('shift+a', callbackB);
|
|
|
|
|
|
|
|
|
@ -341,7 +345,7 @@ describe('\n Hotkeys.js Test Case.\n', () => {
|
|
|
|
|
shiftKey: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(callbackB.mock.calls.length).toBe(1);
|
|
|
|
|
expect(callbackB.mock.calls.length).toBe(0);
|
|
|
|
|
|
|
|
|
|
hotkeys.unbind('shift+a', callbackB);
|
|
|
|
|
|
|
|
|
@ -349,7 +353,7 @@ describe('\n Hotkeys.js Test Case.\n', () => {
|
|
|
|
|
shiftKey: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(callbackB.mock.calls.length).toBe(1);
|
|
|
|
|
expect(callbackB.mock.calls.length).toBe(0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('HotKeys Key combination Test Case', async () => {
|
|
|
|
@ -532,7 +536,7 @@ describe('\n Hotkeys.js Test Case.\n', () => {
|
|
|
|
|
await __triggerKeyboardEvent(document.body, 65, {
|
|
|
|
|
ctrlKey: true,
|
|
|
|
|
});
|
|
|
|
|
expect(hotkeys.getScope()).toBe('all');
|
|
|
|
|
expect(hotkeys.getScope()).toBe('scope3');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('HotKeys modifier noConflict Test Case', async () => {
|
|
|
|
|