@open-wc/testing
Testing following open-wc recommendations
Last updated 8 days ago by d4kmor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @open-wc/testing 
SYNC missed versions from official npm registry.

permalink: 'testing/testing.html' title: Testing section: guides tags:

  • guides

Testing

An opinionated package that combines and configures testing libraries to minimize the amount of ceremony required when writing tests.

Part of Open Web Components: guides, tools and libraries for modern web development and web components

CircleCI BrowserStack Status Renovate enabled

Step by step guide

To help you get started with testing, we recommend reading this article for a great step by step guide.

Testing helpers

Exposes all functions of @open-wc/testing-helpers, so that you have a single package to import from:

import { fixture, html } from '@open-wc/testing';

describe('my-test', () => {
  it('works', async () => {
    const el = await fixture(html` <my-element></my-element> `);
  });
});

Chai

Exposes chai as an es module with useful plugins pre-configured:

@open-wc/semantic-dom-diff for dom tree / snapshot testing:

import { expect, fixture, html } from '@open-wc/testing';

describe('Plugin - semantic-dom-diff', () => {
  it('can semantically compare full dom trees', async () => {
    const el = await fixture(`<div><!-- comment --><h1>${'Hey'}  </h1>  </div>`);
    expect(el).dom.to.equal('<div><h1>Hey</h1></div>');
  });

  it('can semantically compare lightDom trees', async () => {
    const el = await fixture(`<div><!-- comment --><h1>${'Hey'}  </h1>  </div>`);
    expect(el).lightDom.to.equal('<h1>Hey</h1>');
  });

  it('can compare against a snapshot', async () => {
    const el = await fixture(`<div><!-- comment --><h1>${'Hey'}  </h1>  </div>`);
    expect(el).dom.to.equalSnapshot();
  });
});

@open-wc/chai-a11y-axe for a11y testing:

import { expect, fixture, html } from '@open-wc/testing';

describe('my-test', () => {
  it('works', async () => {
    const el = await fixture(html` <my-element></my-element> `);
    await expect(el).to.be.accessible();
  });
});

chai-dom for dom testing:

import { fixture, expect } from '@open-wc/testing';

describe('Plugin - chai-dom', () => {
  it('can check for an exiting css class', async () => {
    const el = await fixture(`<div class="foo bar"></div>`);
    expect(el).to.have.class('foo');
  });
});

Current Tags

  • 2.5.17                                ...           latest (8 days ago)

154 Versions

  • 2.5.17                                ...           8 days ago
  • 2.5.16                                ...           a month ago
  • 2.5.15                                ...           a month ago
  • 2.5.14                                ...           a month ago
  • 2.5.13                                ...           a month ago
  • 2.5.12                                ...           a month ago
  • 2.5.11                                ...           2 months ago
  • 2.5.10                                ...           2 months ago
  • 2.5.9                                ...           2 months ago
  • 2.5.8                                ...           2 months ago
  • 2.5.7                                ...           2 months ago
  • 2.5.6                                ...           3 months ago
  • 2.5.5                                ...           3 months ago
  • 2.5.4                                ...           4 months ago
  • 2.5.3                                ...           4 months ago
  • 2.5.2                                ...           4 months ago
  • 2.5.1                                ...           4 months ago
  • 2.5.0                                ...           5 months ago
  • 2.4.4                                ...           5 months ago
  • 2.4.3                                ...           5 months ago
  • 2.4.2                                ...           6 months ago
  • 2.4.1                                ...           6 months ago
  • 2.3.9                                ...           7 months ago
  • 2.3.8                                ...           7 months ago
  • 2.3.7                                ...           7 months ago
  • 2.3.6                                ...           7 months ago
  • 2.3.5                                ...           8 months ago
  • 2.3.4                                ...           9 months ago
  • 2.3.3                                ...           9 months ago
  • 2.3.2                                ...           9 months ago
  • 2.3.1                                ...           10 months ago
  • 2.3.0                                ...           10 months ago
  • 2.2.8                                ...           10 months ago
  • 2.2.7                                ...           10 months ago
  • 2.2.6                                ...           10 months ago
  • 2.2.5                                ...           10 months ago
  • 2.2.4                                ...           10 months ago
  • 2.2.3                                ...           10 months ago
  • 2.2.2                                ...           10 months ago
  • 2.2.1                                ...           10 months ago
  • 2.2.0                                ...           10 months ago
  • 2.1.4                                ...           10 months ago
  • 2.1.3                                ...           10 months ago
  • 2.1.2                                ...           10 months ago
  • 2.1.1                                ...           10 months ago
  • 2.1.0                                ...           10 months ago
  • 2.0.7                                ...           10 months ago
  • 2.0.6                                ...           10 months ago
  • 2.0.5                                ...           10 months ago
  • 2.0.4                                ...           10 months ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.0.15                                ...           a year ago
  • 1.0.14                                ...           a year ago
  • 1.0.13                                ...           a year ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           a year ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.12.6                                ...           a year ago
  • 0.12.5                                ...           a year ago
  • 0.12.4                                ...           a year ago
  • 0.12.3                                ...           a year ago
  • 0.12.2                                ...           a year ago
  • 0.12.1                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.7                                ...           a year ago
  • 0.11.6                                ...           a year ago
  • 0.11.5                                ...           a year ago
  • 0.11.4                                ...           a year ago
  • 0.11.3                                ...           a year ago
  • 0.11.2                                ...           a year ago
  • 0.11.1                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.12                                ...           a year ago
  • 0.10.11                                ...           a year ago
  • 0.10.10                                ...           a year ago
  • 0.10.9                                ...           a year ago
  • 0.10.8                                ...           a year ago
  • 0.10.7                                ...           a year ago
  • 0.10.6                                ...           a year ago
  • 0.10.5                                ...           a year ago
  • 0.10.4                                ...           a year ago
  • 0.10.3                                ...           a year ago
  • 0.10.2                                ...           a year ago
  • 0.10.1                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.28                                ...           a year ago
  • 0.9.27                                ...           a year ago
  • 0.9.26                                ...           a year ago
  • 0.9.25                                ...           a year ago
  • 0.9.24                                ...           a year ago
  • 0.9.23                                ...           a year ago
  • 0.9.22                                ...           a year ago
  • 0.9.21                                ...           a year ago
  • 0.9.20                                ...           a year ago
  • 0.9.19                                ...           a year ago
  • 0.9.18                                ...           a year ago
  • 0.9.17                                ...           a year ago
  • 0.9.16                                ...           a year ago
  • 0.9.15                                ...           a year ago
  • 0.9.14                                ...           a year ago
  • 0.9.13                                ...           a year ago
  • 0.9.12                                ...           a year ago
  • 0.9.11                                ...           a year ago
  • 0.9.10                                ...           a year ago
  • 0.9.9                                ...           a year ago
  • 0.9.8                                ...           a year ago
  • 0.9.7                                ...           a year ago
  • 0.9.6                                ...           a year ago
  • 0.9.5                                ...           a year ago
  • 0.9.4                                ...           a year ago
  • 0.9.3                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.6                                ...           a year ago
  • 0.8.5                                ...           a year ago
  • 0.8.4                                ...           a year ago
  • 0.8.3                                ...           a year ago
  • 0.8.2                                ...           a year ago
  • 0.8.1                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.2                                ...           a year ago
  • 0.7.1                                ...           a year ago
  • 0.7.0                                ...           a year ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 33
Last Month 1,004
Dependencies (12)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |