From b5d623957bf181a4fbe2ca69bd6e1e93f38dfa2e Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Tue, 3 Dec 2024 15:52:43 +0200 Subject: [PATCH] chore: Fix formatting --- README.md | 2 +- e2e-tests/util/basic.ts | 25 ++--- e2e-tests/util/keyboard-event-cap.html | 129 ++++++++++++++----------- index.html | 22 ++--- 4 files changed, 99 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index fbdc1a3..303bf79 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # `logseq` Sample Plugin -This is a template for `logseq` plugin. It has a very basic structure and e2e tests setup. \ No newline at end of file +This is a template for `logseq` plugin. It has a very basic structure and e2e tests setup. diff --git a/e2e-tests/util/basic.ts b/e2e-tests/util/basic.ts index 48164cb..3a0f461 100644 --- a/e2e-tests/util/basic.ts +++ b/e2e-tests/util/basic.ts @@ -10,33 +10,34 @@ export const IsCI = process.env.CI === 'true' export const modKey = IsMac ? 'Meta' : 'Control' export function randomString(length: number) { - const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const characters = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' - let result = ''; - const charactersLength = characters.length; + let result = '' + const charactersLength = characters.length for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); + result += characters.charAt(Math.floor(Math.random() * charactersLength)) } - return result; + return result } export function randomLowerString(length: number) { - const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; + const characters = 'abcdefghijklmnopqrstuvwxyz0123456789' - let result = ''; - const charactersLength = characters.length; + let result = '' + const charactersLength = characters.length for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); + result += characters.charAt(Math.floor(Math.random() * charactersLength)) } - return result; + return result } export function randomInt(min: number, max: number): number { return Math.floor(Math.random() * (max - min + 1) + min) } - + export function randomBoolean(): boolean { - return Math.random() < 0.5; + return Math.random() < 0.5 } diff --git a/e2e-tests/util/keyboard-event-cap.html b/e2e-tests/util/keyboard-event-cap.html index 79bf541..2b20ab2 100644 --- a/e2e-tests/util/keyboard-event-cap.html +++ b/e2e-tests/util/keyboard-event-cap.html @@ -1,64 +1,83 @@ - + + + - + document.addEventListener( + 'keydown', + key_handler_builder('keydown'), + false + ) + document.addEventListener('keyup', key_handler_builder('keyup'), false) + document.addEventListener( + 'keypress', + key_handler_builder('keypress'), + false + ) + document.addEventListener( + 'compositionstart', + key_handler_builder('compositionstart'), + false + ) + document.addEventListener( + 'compositionend', + key_handler_builder('compositionend'), + false + ) + document.addEventListener( + 'compositionupdate', + key_handler_builder('compositionupdate'), + false + ) - - -

Key Down

-

- + window.onload = (e) => { + document.getElementById('input').focus() + } + + - \ No newline at end of file + + +

Key Down

+

+ + diff --git a/index.html b/index.html index f500bb7..a80660d 100644 --- a/index.html +++ b/index.html @@ -1,17 +1,17 @@ - - - - - + + + + Document - + - +

- - - \ No newline at end of file + +