basic-keyboard-event-polyfill

1.0.1 • Public • Published

basic-keyboard-event-polyfill

Build Status

A simple polyfill to help PhantomJS out.

Typlically in JS this is pretty easy to sort out in tests, by creating the event and initialising the Keyboard Event manually. Like in here. However, when running tests for Angular2+ in Typescript you can't just assign a value to the event. They are all readonly. So you can have your tests pass but not linting (if you have --type-check) enabled.

Having this be a package you can just require, means your linting doesn't touch it as it stays in JS land.

Function originally taken from https://github.com/ariya/phantomjs/issues/11289 @runarberg (which was taken from DOM-Keyboard-Event-Level-3-polyfill and modified slightly. I don't actually need the full polyfill hence this light weight JS that can be loaded via NPM outside of the tslint and typechecking.

Install for dev via:

  • npm install basic-keyboard-event-polyfill --save-dev
  • yarn add basic-keyboard-event-polyfill --dev

Package Sidebar

Install

npm i basic-keyboard-event-polyfill

Weekly Downloads

39

Version

1.0.1

License

MIT

Last publish

Collaborators

  • justingrayston