# chai-snabbdom

> Chai plugin with assertions for snabbdom (forked from André Staltz's chai-virtual-dom)

Latest version **1.0.0** (published 2017-07-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install chai-snabbdom
pnpm add chai-snabbdom
yarn add chai-snabbdom
bun add chai-snabbdom
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-07-21 |
| First published | 2017-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mathieu Eveillard |
| Maintainers | mathieueveillard |
| Keywords | snabbdom, chai, mocha, test, vnode, cycle, time |

## Links

- npm: https://www.npmjs.com/package/chai-snabbdom
- Repository: https://github.com/mathieueveillard/chai-snabbdom
- Homepage: https://github.com/mathieueveillard/chai-snabbdom#readme
- Issues: https://github.com/mathieueveillard/chai-snabbdom/issues
- npm.io page: https://npm.io/package/chai-snabbdom

## Dependencies (1)

- [snabbdom-to-html](https://npm.io/package/snabbdom-to-html.md) ^3.2.0

## Recent versions

- 1.0.0 (latest) — 2017-07-21

## README

# chai-snabbdom

[snabbdom](https://github.com/snabbdom/snabbdom) assertions for chai. Tests your virtual dom elements (vnodes). Snabbdom is the virtual dom implementation chosen to build [Cycle.js](https://cycle.js.org/) [DOM driver](https://github.com/cyclejs/cyclejs/tree/master/dom). Forked from André Staltz's [chai-virtual-dom](https://github.com/staltz/chai-virtual-dom).

<!--[![NPM version](http://img.shields.io/npm/v/chai-virtual-dom.svg?style=flat-square)](https://www.npmjs.org/package/chai-virtual-dom)
[![Build Status](https://travis-ci.org/staltz/chai-virtual-dom.svg?branch=master)](https://travis-ci.org/staltz/chai-virtual-dom)-->

#### Summary

```js
// Approximate match
// Use .look.like() to do an approximate assertion.
// Must match: tag name, id, className.
// Must match only if provided in expected: children.
expect(myVTree).to.look.like(expected);
```

```js
// Accurate match
// Use .look.exactly.like() to do a strict assertion.
// Must match: tag name, id, className, and children.
expect(myVTree).to.look.exactly.like(expected);
```

#### Example

```js
var chai = require('chai');
var expect = chai.expect;
chai.use(require('chai-snabbdom'));
var h = require('snabbdom').h;

describe('My snabbdom project', function () {
  var myVTree = h('div#foo', [
    h('h1.header', {}, 'Welcome to our webpage'),
    h('ol.list', {}, [
      h('li', {}, 'First thing'),
      h('li', {}, 'Second thing'),
      h('li', {}, 'Third thing')
    ]),
  ]);

  it('should look roughly like a list', function () {
    var expected = h('div#foo', {}, [
      h('h1.header'),
      h('ol.list')
    ]);
    expect(myVTree).to.look.like(expected);
  });

  it('should look exactly like a list', function () {
    var expected = h('div#foo', {}, [
      h('h1.header', {}, 'Welcome to our webpage'),
      h('ol.list', {}, [
        h('li', {}, 'First thing'),
        h('li', {}, 'Second thing'),
        h('li', {}, 'Third thing')
      ]),
    ]);
    expect(myVTree).to.look.exactly.like(expected);
  });
});
```
<!--
#### Installation

This is a plugin for the [Chai Assertion Library](http://chaijs.com). Install via [npm](http://npmjs.org).

    npm install --save-dev chai-snabbdom

#### Usage

To use this plugin in your tests, import as such:

```js
var chai = require('chai');
chai.use(require('chai-snabbdom'));
```

-->

#### LICENSE

Copyright (c) 2017 Mathieu Eveillard. Licensed under the MIT license.

---
_Source: https://npm.io/package/chai-snabbdom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
