New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

test-keyboard

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-keyboard - npm Package Compare versions

Comparing version

to
0.0.0-pr1801.3

9

package.json
{
"name": "test-keyboard",
"version": "0.0.0-pr1801.2",
"version": "0.0.0-pr1801.3",
"description": "A test keyboard for composing fake keyboard events",

@@ -40,4 +40,4 @@ "keywords": [

"@babel/runtime": "^7.13.10",
"@remirror/core-helpers": "0.0.0-pr1801.2",
"@remirror/core-types": "0.0.0-pr1801.2"
"@remirror/core-helpers": "0.0.0-pr1801.3",
"@remirror/core-types": "0.0.0-pr1801.3"
},

@@ -49,3 +49,4 @@ "publishConfig": {

"sizeLimit": "10 KB"
}
},
"readme": "# test-keyboard\n\n[![npm](https://img.shields.io/npm/dm/test-keyboard.svg?&logo=npm)](https://www.npmjs.com/package/test-keyboard)\n\nA test keyboard for dispatching events to the dom which mimics keyboard actions from the user.\n\n## The problem\n\nYou 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.\n\n## This solution\n\n`test-keyboard` is an elegant way of composing keyboard events together as if a user was typing.\n\nIt is primarily designed for dom-test environments but could be extracted out into something that can be used in your front-end code.\n\n## Installation\n\n```bash\nyarn add test-keyboard # yarn\npnpm add test-keyboard # pnpm\nnpm install test-keyboard # npm\n```\n\n## `Keyboard.create` - `(params: KeyboardConstructorParameter) => Keyboard`\n\n```ts\nimport { Keyboard } from 'test-keyboard';\n\nconst target = document.querySelector('#editor');\nKeyboard.create({\n target,\n})\n .start() // Allows events to be dispatched\n .mod({ text: 'Ctrl-Shift-Enter' })\n .end(); // Dispatches al the events.\n```\n\n### `KeyboardConstructorParameter`\n\n| **Property** | **Type** | **Default** | **Description** |\n| --- | :-: | :-: | --- |\n| `target` | `Element` | **REQUIRED** | The target of our events. |\n| `defaultOptions` | `KeyboardEventInit` | `{}` | The target of our events. |\n| `isMac` | `boolean` | `false` | Whether to simulate a mac. |\n| `batch` | `boolean` | `false` | Whether to wait until end is called before running all accumulated actions. |\n| `onEventDispatch` | `(event: KeyboardEvent) => void` | `() => {}` | Called whenever an event is dispatched with the keyboard event as a parameter. |\n\n## Acknowledgements\n\n- [Puppeteer](https://github.com/GoogleChrome/puppeteer) for providing the _US Keyboard_ information.\n"
}