Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eduardoboucas/preact-jsx-chai-match-template

🗜 A method that adds assertions with html-looks-like to Chai for testing Preact components
https://github.com/eduardoboucas/preact-jsx-chai-match-template

chai html-looks-like preact

Last synced: 15 days ago
JSON representation

🗜 A method that adds assertions with html-looks-like to Chai for testing Preact components

Awesome Lists containing this project

README

        

# preact-jsx-chai-match-template

A method that adds assertions with [html-looks-like](https://github.com/staltz/html-looks-like) to Chai for testing Preact components.

## Installation

1. Download the module

```
npm install preact-jsx-chai-match-template --save-dev
```

1. Add it to Chai

```jsx
import chai from 'chai'
import assertMatch from 'preact-jsx-chai-match-template'

chai.use(assertMatch)
```

## Usage

```jsx
const component = (


Previous


Hello world


This is a test


Next


)

const template = (


(...)


Hello world


(...)

(...)


)

expect(component).to.matchTemplate(template)
```