Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wyze/bs-jest-dom
BuckleScript bindings for jest-dom.
https://github.com/wyze/bs-jest-dom
Last synced: about 2 months ago
JSON representation
BuckleScript bindings for jest-dom.
- Host: GitHub
- URL: https://github.com/wyze/bs-jest-dom
- Owner: wyze
- License: mit
- Created: 2018-09-18T02:05:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:42:43.000Z (over 1 year ago)
- Last Synced: 2024-07-11T23:11:43.905Z (2 months ago)
- Language: Reason
- Homepage: https://yarn.pm/bs-jest-dom
- Size: 1.3 MB
- Stars: 13
- Watchers: 3
- Forks: 7
- Open Issues: 15
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
- awesome-list - bs-jest-dom - dom. | wyze | 13 | (Reason)
README
# bs-jest-dom · [![Build Status][actions-image]][actions-url] [![npm][npm-image]][npm-url] [![Codecov][codecov-image]][codecov-url]
> [BuckleScript](//github.com/BuckleScript/bucklescript) bindings for [jest-dom](//github.com/testing-library/jest-dom).
## Installation
```sh
$ yarn add --dev bs-jest-dom# or..
$ npm install --save-dev bs-jest-dom
```## Usage
#### Add to `bsconfig.json`
```json
{
"bs-dev-dependencies": ["bs-jest-dom"]
}
```#### With [`bs-jest`](//github.com/glennsl/bs-jest) and [`bs-react-testing-library`](//github.com/wyze/bs-react-testing-library)
```ocaml
/* Heading_test.re */open Jest;
open JestDom;
open ReactTestingLibrary;module Heading = {
[@react.component]
let make = (~text) =>{ReasonReact.string(text)}
;
};test("renders in the document", () =>
|> render
|> getByText(~matcher=`Str("Hello, World!"))
|> expect
|> toBeInTheDocument
);
```#### With [`bs-jest`](//github.com/glennsl/bs-jest) and [`bs-webapi`](//github.com/reasonml-community/bs-webapi-incubator)
```ocaml
/* Heading_test.re */open Jest;
open JestDom;
open Webapi.Dom;
open Webapi.Dom.Element;test("heading is visible", () => {
let div = Document.createElement("div", document);div->setInnerHTML("
Hello, World!
");div
|> querySelector("h1")
|> expect
|> toBeVisible;
});
```## Examples
See [`src/__tests__`](src/__tests__) for some examples.
## Development
```sh
$ git clone https://github.com/wyze/bs-jest-dom.git
$ cd bs-jest-dom
$ yarn # or `npm install`
```## Build
```sh
$ yarn build
```## Test
```sh
$ yarn test
```## Change Log
> [Full Change Log](changelog.md)
### [v4.1.1](https://github.com/wyze/bs-jest-dom/releases/tag/v4.1.1) (2020-06-17)
* Fix JSX and bs-webapi to compile on BS 8 ([@johnridesabike](https://github.com/johnridesabike) in [#20](https://github.com/wyze/bs-jest-dom/pull/20))
## License
MIT © [Neil Kistner](https://neilkistner.com)
[actions-image]: https://img.shields.io/github/workflow/status/wyze/bs-jest-dom/CI.svg?style=flat-square
[actions-url]: https://github.com/wyze/bs-jest-dom/actions[npm-image]: https://img.shields.io/npm/v/bs-jest-dom.svg?style=flat-square
[npm-url]: https://npm.im/bs-jest-dom[codecov-image]: https://img.shields.io/codecov/c/github/wyze/bs-jest-dom.svg?style=flat-square
[codecov-url]: https://codecov.io/github/wyze/bs-jest-dom