stencil-test-helpers
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Stencil Test Helpers

Build Status Coverage Status

This code is a port from the great ember-test-helpers to be used in Stencil projects.

Getting Started

npm install stencil-test-helpers

So helpers know how to do their thing, the TestWindow class provided by this package needs to be used. It behaves as the normal TestWindow, but with a couple of extra magic bits that let the helpers use their magic.

You need to add a removeTestWindow call in the aferEach hook.

The basic scaffold is:

import { TestWindow, removeTestWindow } from 'stencil-test-helpers';

describe('something', () => {
  afterEach(() => {
    removeTestWindow();
  });
});

Helpers

All the helpers accept a target both as a string (CSS selector) or an Element. All helpers will wait until the next tick before and after doing its work.

The available helpers are:

  • blur(target)
  • click(target)
  • doubleClick(target)
  • fillIn(target, value: string)
  • focus(target)
  • getElement(target): Element | null
  • tap(target, options)
  • triggerEvent(target, event, options)
  • triggerKeyEvent(target, keyEventType, keyOrKeyCode, modifiers)

Readme

Keywords

none

Package Sidebar

Install

npm i stencil-test-helpers

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

202 kB

Total Files

59

Last publish

Collaborators

  • serabe