Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/eduardoboucas/preact-jsx-chai-match-template
- Owner: eduardoboucas
- Created: 2017-09-26T13:43:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-26T16:07:02.000Z (over 7 years ago)
- Last Synced: 2024-10-06T03:21:42.588Z (3 months ago)
- Topics: chai, html-looks-like, preact
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)
```