elr-vue-jest-helpers

0.0.12 • Public • Published

ELR Vue Test Helpers

A small library of test methods to speed up Vue component testing

Build Status License: MIT npm

For use with VueTestUtils and Jest

npm install elr-vue-jest-helpers --save-dev

or

yarn add elr-vue-jest-helpers -D

import helpers from 'elr-vue-jest-helpers';

Initialize the helpers library after you mount your wrapper component pass in the Vue component instance pass in the expect method from Jest all methods are chainable

h.init({wrapper, expect});

*** if you mount your component again you must reinitialize the test utilities so they can interact with your new wrapper.

Methods

  • select
    • select an option in a select form field
h.select('California', '#states');
  • type
    • type some input into a form field
  • blur
    • trigger blur event on form field
  • submit
    • trigger a submit event on a form field
  • clear
    • clear value from form field
  • click
    • trigger a click event
  • emit
    • test that an event is emitted
  • doesNotEmit
    • test that an event is not emmitted
  • payloadEquals
    • check the content of an event payload
  • contains
  • doesNotContain
  • matches
  • see
  • html
  • hasStyle
  • isHidden
  • isValidInput
  • isInvalidInput
  • hasCount
  • hasClass
  • notToHaveClass
  • isDisabled
  • isNotDisabled
  • text

Package Sidebar

Install

npm i elr-vue-jest-helpers

Weekly Downloads

1

Version

0.0.12

License

MIT

Unpacked Size

6.99 kB

Total Files

4

Last publish

Collaborators

  • beth_rogers465