Skip to content

wyze/bs-dom-testing-library

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

bs-dom-testing-library · Build Status npm Coveralls

BuckleScript bindings for dom-testing-library.

Documentation

Read the docs | Edit the docs

Installation

$ yarn add --dev bs-dom-testing-library

# or..

$ npm install --save-dev bs-dom-testing-library

Usage

Add to bsconfig.json

{
  "bs-dev-dependencies": [
    "bs-dom-testing-library"
  ]
}

With bs-jest

/* Header_test.re */

open Jest;
open Expect;
open Webapi.Dom;
open Webapi.Dom.Element;

test("header exists", () => {
  let div = Document.createElement("div", document);

  div->setInnerHTML({|<h1>Hello, World!</h1>|});

  div
  |> getByText(~matcher=`Str("Hello, World!"))
  |> expect
  |> ExpectJs.toBeTruthy;
});

Examples

See src/__tests__ for some examples.

Development

$ git clone https://github.com/wyze/bs-dom-testing-library.git
$ cd bs-dom-testing-library
$ yarn # or `npm install`

Build

$ yarn build

Test

$ yarn test

Change Log

Full Change Log

v0.7.0 (2020-10-21)

  • Add waitForElementToBeRemoved (@wyze in #23)
  • Add more ByRole options (@wyze in #22)
  • Update some of the utility functions (@wyze in #21)
  • Add sponsor button (@wyze in dec1dab)
  • Upgrade to latest dependencies (@wyze in #20)

License

MIT © Neil Kistner