Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
test-keyboard
Advanced tools
A test keyboard for dispatching events to the dom which mimics keyboard actions from the user.
You want to write tests for code that makes heavy usage of the keyboard and you're finding it hard to compose these keyboard events together.
test-keyboard
is an elegant way of composing keyboard events together as if a user was typing.
It is primarily designed for dom-test environments but could be extracted out into something that can be used in your front-end code.
yarn add test-keyboard
Keyboard.create
- (params: KeyboardConstructorParams) => Keyboard
import { Keyboard } from 'test-keyboard';
const target = document.getElementById('editor');
Keyboard.create({
target,
})
.start() // Allows events to be dispatched
.mod({ text: 'Ctrl-Shift-Enter' })
.end(); // Dispatches al the events.
};
KeyboardConstructorParams
Property | Type | Default | Description |
---|---|---|---|
target | Element | REQUIRED | The target of our events. |
defaultOptions | KeyboardEventInit | {} | The target of our events. |
isMac | boolean | false | Whether to simulate a mac. |
batch | boolean | false | Whether to wait until end is called before running all accumulated actions. |
onEventDispatch | (event: KeyboardEvent) => void | () => {} | Called whenever an event is dispatched with the keyboard event as a parameter. |
FAQs
A test keyboard for composing fake keyboard events
The npm package test-keyboard receives a total of 3,325 weekly downloads. As such, test-keyboard popularity was classified as popular.
We found that test-keyboard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.