test-keyboard
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export declare type KeyboardEventName = 'keydown' | 'keyup' | 'keypress'; | ||
export type KeyboardEventName = 'keydown' | 'keyup' | 'keypress'; | ||
export interface OptionsProps { | ||
@@ -39,3 +39,3 @@ /** | ||
} | ||
export declare type TypingInputProps = Omit<TextInputProps, 'typing'>; | ||
export type TypingInputProps = Omit<TextInputProps, 'typing'>; | ||
export interface IsTypingProps { | ||
@@ -42,0 +42,0 @@ /** Indicates whether the text input is part of a typing sequence (i.e. into an editor) |
@@ -21,3 +21,3 @@ import type { KeyboardConstructorProps, KeyboardEventName, OptionsProps, TextInputProps, TypingInputProps } from './test-keyboard-types'; | ||
*/ | ||
export declare type BatchedCallback = (action: BatchedKeyboardAction, index: number, actions: BatchedKeyboardAction[]) => void; | ||
export type BatchedCallback = (action: BatchedKeyboardAction, index: number, actions: BatchedKeyboardAction[]) => void; | ||
export declare class Keyboard { | ||
@@ -24,0 +24,0 @@ static create(props: KeyboardConstructorProps): Keyboard; |
@@ -1357,4 +1357,4 @@ /** | ||
} | ||
export declare type USKeyboardLayout = typeof rawUSKeyboardLayout; | ||
export declare type SupportedCharacters = Extract<keyof USKeyboardLayout, string>; | ||
export type USKeyboardLayout = typeof rawUSKeyboardLayout; | ||
export type SupportedCharacters = Extract<keyof USKeyboardLayout, string>; | ||
/** | ||
@@ -1361,0 +1361,0 @@ * Predicate for checking if the passed char is a supported character for the US |
{ | ||
"name": "test-keyboard", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A test keyboard for composing fake keyboard events", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
"@remirror/core-helpers": "^2.0.1", | ||
"@remirror/core-types": "^2.0.3" | ||
"@remirror/core-types": "^2.0.4" | ||
}, | ||
@@ -49,4 +49,3 @@ "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" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
232914
14
3488
Updated@remirror/core-types@^2.0.4