Directory

← Back

iron-test-helpers

Utility classes to make testing easier

Author

Rating

Popularity

<100

Published on NPM Build status Published on webcomponents.org

iron-test-helpers

A set of utility classes to make testing easier. For more details on the methods available, please check the documentation of mock-interactions.js and test-helpers.js

See: Documentation.

Usage

Mock Interactions

This is a set of methods to simulate mouse or keyboard interaction with an element.

import {pressSpace, tap} from '@polymer/iron-test-helpers/mock-interactions.js';

test('can be triggered with space', function(done) {
  button.addEventListener('keydown', function() {
    done();
  });
  pressSpace(button);
});

test('can be clicked', function(done) {
  button.addEventListener('click', function() {
    done();
  });
  tap(button);
});

Note on globals

Note that in version 3.x, importing mock-interactions.js and test-helpers.js will also set the window.MockInteractions and window.TestHelpers globals, respectively (and importing iron-test-helpers.js will set both). This is done only for backwards compatibility, and will be removed in the next major version. All users should migrate away from globals and onto direct ES module imports.

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/iron-test-helpers
cd iron-test-helpers
npm install
npm install -g polymer-cli

Running the tests

polymer test --npm

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

  • @polymer/polymer#^3.0.0
Released
2018-09-14
Maturity
IMPORTED
License
BSD 3-clause "New" or "Revised" License

Compatibility

Framework
Polymer 3.0+
Polymer 2.0+ in 2.0.1
Polymer 1.0+ in 1.4.1
Browser
Browser Independent

iron-test-helpers - Vaadin Add-on Directory

Utility classes to make testing easier iron-test-helpers - Vaadin Add-on Directory
[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-test-helpers.svg)](https://www.npmjs.com/package/@polymer/iron-test-helpers) [![Build status](https://travis-ci.org/PolymerElements/iron-test-helpers.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-test-helpers) [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/iron-test-helpers) ## iron-test-helpers A set of utility classes to make testing easier. For more details on the methods available, please check the documentation of `mock-interactions.js` and `test-helpers.js` See: [Documentation](https://www.webcomponents.org/element/@polymer/iron-test-helpers). ## Usage ### Mock Interactions This is a set of methods to simulate mouse or keyboard interaction with an element. ```javascript import {pressSpace, tap} from '@polymer/iron-test-helpers/mock-interactions.js'; test('can be triggered with space', function(done) { button.addEventListener('keydown', function() { done(); }); pressSpace(button); }); test('can be clicked', function(done) { button.addEventListener('click', function() { done(); }); tap(button); }); ``` ### Note on globals Note that in version 3.x, importing `mock-interactions.js` and `test-helpers.js` will also set the `window.MockInteractions` and `window.TestHelpers` globals, respectively (and importing `iron-test-helpers.js` will set both). This is done only for backwards compatibility, and will be removed in the next major version. All users should migrate away from globals and onto direct ES module imports. ## Contributing If you want to send a PR to this element, here are the instructions for running the tests and demo locally: ### Installation ```sh git clone https://github.com/PolymerElements/iron-test-helpers cd iron-test-helpers npm install npm install -g polymer-cli ``` ### Running the tests ```sh polymer test --npm ```
License
View on NPM
View on GitHub

iron-test-helpers version 0.8.0
### Dependencies * polymer#polymer/polymer#v0.8.0-rc.6

iron-test-helpers version 0.8.1
### Dependencies * polymer#polymer/polymer#v0.8.0-rc.7

iron-test-helpers version 0.8.2
### Dependencies * polymer#polymer/polymer#v0.8.0-rc.7

iron-test-helpers version 0.8.3
### Dependencies * polymer#polymer/polymer#v0.8.0-rc.7

iron-test-helpers version 0.9.0
### Dependencies * polymer#polymer/polymer#v0.9.0-rc.1

iron-test-helpers version 0.9.1
### Dependencies * polymer#polymer/polymer#v0.9.0-rc.1

iron-test-helpers version 0.9.2
### Dependencies * polymer#polymer/polymer#v0.9.0-rc.1

iron-test-helpers version 0.9.3
### Dependencies * polymer#polymer/polymer#v0.9.0-rc.1

iron-test-helpers version 0.9.4
### Dependencies * polymer#Polymer/polymer#^0.9.0

iron-test-helpers version 0.9.5
### Dependencies * polymer#Polymer/polymer#^0.9.0

iron-test-helpers version 0.9.6
### Dependencies * polymer#Polymer/polymer#^0.9.0

iron-test-helpers version 1.0.0
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.1
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.2
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.3
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.4
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.5
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.0.6
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.1.0
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.1.1
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.1.2
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.1.3
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 0.0.1
### Dependencies * @polymer/polymer#^1.2.5-npm-test.2

iron-test-helpers version 0.0.3
### Dependencies * @polymer/polymer#^1.2.5-npm-test.2

iron-test-helpers version 1.1.4
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.1.5
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.0
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.1
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.2
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.3
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.4
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.2.5
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.3.0
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.4.0
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 1.4.1
### Dependencies * polymer#Polymer/polymer#^1.0.0

iron-test-helpers version 2.0.0
### Dependencies * polymer#Polymer/polymer#1.9 - 2

iron-test-helpers version 3.0.0-pre.1
### Dependencies * @polymer/polymer#^3.0.0-pre.1

iron-test-helpers version 3.0.0-pre.2
### Dependencies * @polymer/polymer#^3.0.0-pre.1

iron-test-helpers version 3.0.0-pre.3
### Dependencies * @polymer/polymer#^3.0.0-pre.3

iron-test-helpers version 3.0.0-pre.4
### Dependencies * @polymer/polymer#^3.0.0-pre.4

iron-test-helpers version 3.0.0-pre.6
### Dependencies * @polymer/polymer#^3.0.0-pre.6

iron-test-helpers version 3.0.0-pre.7
### Dependencies * @polymer/polymer#^3.0.0-pre.7

iron-test-helpers version 3.0.0-pre.8
### Dependencies * @polymer/polymer#^3.0.0-pre.7

iron-test-helpers version 3.0.0-pre.10
### Dependencies * @polymer/polymer#^3.0.0-pre.10

iron-test-helpers version 3.0.0-pre.11
### Dependencies * @polymer/polymer#^3.0.0-pre.10

iron-test-helpers version 3.0.0-pre.12
### Dependencies * @polymer/polymer#3.0.0-pre.12

iron-test-helpers version 3.0.0-pre.13
### Dependencies * @polymer/polymer#^3.0.0-pre.13

iron-test-helpers version 3.0.0-pre.14
### Dependencies * @polymer/polymer#^3.0.0-pre.13

iron-test-helpers version 3.0.0-pre.15
### Dependencies * @polymer/polymer#^3.0.0-pre.13

iron-test-helpers version 3.0.0-pre.16
### Dependencies * @polymer/polymer#^3.0.0-pre.13

iron-test-helpers version 3.0.0-pre.17
### Dependencies * @polymer/polymer#^3.0.0-pre.13

iron-test-helpers version 3.0.0-pre.18
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.19
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 2.0.1
### Dependencies * polymer#Polymer/polymer#1.9 - 2

iron-test-helpers version 3.0.0-pre.20
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.21
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.22
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.23
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.24
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.25
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0-pre.26
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.0
### Dependencies * @polymer/polymer#^3.0.0

iron-test-helpers version 3.0.1
### Dependencies * @polymer/polymer#^3.0.0

Online