https://github.com/gajus/ava-dom
Port of jest-dom to ava.
https://github.com/gajus/ava-dom
ava dom jest test
Last synced: 4 months ago
JSON representation
Port of jest-dom to ava.
- Host: GitHub
- URL: https://github.com/gajus/ava-dom
- Owner: gajus
- License: other
- Created: 2020-09-16T22:31:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-16T22:47:17.000Z (almost 5 years ago)
- Last Synced: 2025-03-02T06:19:51.682Z (5 months ago)
- Topics: ava, dom, jest, test
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ava-dom
[](https://travis-ci.org/gajus/ava-dom)
[](https://coveralls.io/github/gajus/ava-dom)
[](https://www.npmjs.org/package/ava-dom)
[](https://github.com/gajus/canonical)
[](https://twitter.com/kuizinas)Port of [jest-dom](https://github.com/testing-library/jest-dom) to [ava](https://www.npmjs.com/package/ava).
## Installation
```bash
npm install --save-dev ava-dom```
Configure ava to `require` `ava-dom/shim` before every test file.
```json
{
"ava": {
"require": [
"ava-dom/shim"
]
}
}```
Alternatively, just import and call `shim` function in ava test.
```js
import ava from 'ava';
import {
shim,
} from 'ava-dom';shim();
```
## Usage
ava-dom adds all jest-dom methods to ava assertions prototype, i.e. all jest-dom methods are accessible under ava's `t` variable.
```js
import ava from 'ava';test();
```
## Compatibility with jest-dom
All [jest-dom](https://github.com/testing-library/jest-dom) methods are available in ava-dom
* [`toBeChecked`](https://github.com/testing-library/jest-dom#tobechecked)
* [`toBeDisabled`](https://github.com/testing-library/jest-dom#tobedisabled)
* [`toBeEmpty`](https://github.com/testing-library/jest-dom#tobeempty)
* [`toBeEmptyDOMElement`](https://github.com/testing-library/jest-dom#tobeemptydomelement)
* [`toBeEnabled`](https://github.com/testing-library/jest-dom#tobeenabled)
* [`toBeInTheDocument`](https://github.com/testing-library/jest-dom#tobeinthedocument)
* [`toBeInTheDOM`](https://github.com/testing-library/jest-dom#tobeinthedom)
* [`toBeInvalid`](https://github.com/testing-library/jest-dom#tobeinvalid)
* [`toBePartiallyChecked`](https://github.com/testing-library/jest-dom#tobepartiallychecked)
* [`toBeRequired`](https://github.com/testing-library/jest-dom#toberequired)
* [`toBeValid`](https://github.com/testing-library/jest-dom#tobevalid)
* [`toBeVisible`](https://github.com/testing-library/jest-dom#tobevisible)
* [`toContainElement`](https://github.com/testing-library/jest-dom#tocontainelement)
* [`toContainHTML`](https://github.com/testing-library/jest-dom#tocontainhtml)
* [`toHaveAttribute`](https://github.com/testing-library/jest-dom#tohaveattribute)
* [`toHaveClass`](https://github.com/testing-library/jest-dom#tohaveclass)
* [`toHaveDescription`](https://github.com/testing-library/jest-dom#tohavedescription)
* [`toHaveDisplayValue`](https://github.com/testing-library/jest-dom#tohavedisplayvalue)
* [`toHaveFocus`](https://github.com/testing-library/jest-dom#tohavefocus)
* [`toHaveFormValues`](https://github.com/testing-library/jest-dom#tohaveformvalues)
* [`toHaveStyle`](https://github.com/testing-library/jest-dom#tohavestyle)
* [`toHaveTextContent`](https://github.com/testing-library/jest-dom#tohavetextcontent)
* [`toHaveValue`](https://github.com/testing-library/jest-dom#tohavevalue)