Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(commands): allow to fallback to charCodeAt if key is not in keyCodeDefinitions #631

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

huang-julien
Copy link

@huang-julien huang-julien commented Feb 15, 2024

Hello 👋

This PR aims to add a fallback to String.charCodeAt if the key is a single character or a unicode char and if it is not in the KeyCodeDefinition.

This would resolve #614.

Copy link

what-the-diff bot commented Feb 15, 2024

    • In src/commands/realPress.ts, a new function isEmoji was added. This function checks if a given character is an emoji.
  • The getKeyDefinition function in src/commands/realPress.ts was updated to handle unsupported keys. If the key is a single character or an emoji, it will return a key definition object with appropriate values.
  • The KeyOrShortcut type in src/commands/realPress.ts was updated to include arrays of keys.
  • The realPress function in src/commands/realPress.ts now accepts string or string[] as the keyOrShortcut parameter.
  • In src/commands/realType.ts, the import statement for keyCodeDefinitions and realPress was updated to use a named import for KeyOrShortcut from realPress.ts.
  • The assertChar function in src/commands/realType.ts was removed, along with its usage.

@huang-julien huang-julien marked this pull request as draft February 15, 2024 21:18
@huang-julien huang-julien marked this pull request as ready for review February 15, 2024 21:26
@dmtrKovalenko
Copy link
Owner

I really do not understand why because if you don't type a real keycode it is better to use cy.type simply. Plus I expect at least few tests to be written I am not sure it is even working — you need to pass text separately in the CDP

@huang-julien
Copy link
Author

oh cy.type doesn't work with things like CKeditor.
But i do get why you quite reluctant to add a change to it 🙂

Some very simple test were added but that's probably not enough ?
I'm good with closing it if you feel that this shouldn't be supported

@dmtrKovalenko
Copy link
Owner

I'm okay but we need to support as much tests as we need like switching between supported keystrokes and not supported, entering utf-8 characters and so on

@huang-julien huang-julien marked this pull request as draft February 19, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cyrillic letters are not supported for the realType function
2 participants