├── .editorconfig ├── .gitattributes ├── .github ├── funding.yml └── workflows │ └── ci.yml ├── .gitignore ├── bsconfig.json ├── changelog.md ├── license ├── package.json ├── readme.md ├── setupTests.js ├── src ├── ReactTestingLibrary.re ├── ReactTestingLibrary.rei └── __tests__ │ ├── ReactTestingLibrary_test.re │ └── __snapshots__ │ └── ReactTestingLibrary_test.bs.js.snap └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = 2 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js text eol=lf 3 | *.re linguist-language=Reason 4 | -------------------------------------------------------------------------------- /.github/funding.yml: -------------------------------------------------------------------------------- 1 | github: wyze 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | node-version: ['12', '10'] 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Setup Node ${{ matrix.node-version }} 14 | uses: actions/setup-node@v1 15 | with: 16 | node-version: ${{ matrix.node-version }} 17 | - name: Setup Deno 0.40 18 | uses: denolib/setup-deno@220d9c6 19 | with: 20 | deno-version: '0.40' 21 | - run: yarn install --frozen-lockfile 22 | - run: yarn --check-files 23 | - run: deno run --allow-read --allow-write https://denopkg.com/wyze/conditional_bisect@v1.0.1/mod.ts 24 | - run: yarn test:coverage 25 | - run: yarn bisect-ppx-report send-to Codecov 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules 3 | 4 | # Build 5 | _coverage 6 | src/**/*.bs.js 7 | lib 8 | .bsb.lock 9 | .merlin 10 | *.coverage 11 | 12 | # Logs 13 | *.log 14 | 15 | # macOS 16 | .*DS_Store 17 | -------------------------------------------------------------------------------- /bsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bs-react-testing-library", 3 | "bsc-flags": [ 4 | "-bs-no-version-header", 5 | "-bs-super-errors" 6 | ], 7 | "warnings": { 8 | "number": "+A-48-42", 9 | "error": "+A-3-44-102" 10 | }, 11 | "reason": { 12 | "react-jsx": 3 13 | }, 14 | "refmt": 3, 15 | "package-specs": { 16 | "module": "commonjs", 17 | "in-source": true 18 | }, 19 | "suffix": ".bs.js", 20 | "bs-dependencies": [ 21 | "bs-dom-testing-library", 22 | "reason-react" 23 | ], 24 | "bs-dev-dependencies": [ 25 | "@glennsl/bs-jest", 26 | "bisect_ppx" 27 | ], 28 | "sources": [ 29 | { 30 | "dir": "src", 31 | "subdirs": [ 32 | { 33 | "dir": "__tests__", 34 | "type": "dev" 35 | } 36 | ] 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## Change Log 2 | 3 | ### [v0.8.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.8.0) (2020-10-21) 4 | 5 | * Upgrade to latest dependencies ([@wyze](https://github.com/wyze) in [#27](https://github.com/wyze/bs-react-testing-library/pull/27)) 6 | * Add sponsor button ([@wyze](https://github.com/wyze) in [c69f028](https://github.com/wyze/bs-react-testing-library/commit/c69f028)) 7 | 8 | ### [v0.7.3](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.7.3) (2020-06-18) 9 | 10 | * Fix test command ([@wyze](https://github.com/wyze) in [f9c5987](https://github.com/wyze/bs-react-testing-library/commit/f9c5987)) 11 | * Bump version for bs-dom-testing-library ([@johnridesabike](https://github.com/johnridesabike) in [#24](https://github.com/wyze/bs-react-testing-library/pull/24)) 12 | * Change type of cleanup function ([@denis-ok](https://github.com/denis-ok) in [#23](https://github.com/wyze/bs-react-testing-library/pull/23)) 13 | * Use denopkg.com ([@wyze](https://github.com/wyze) in [#22](https://github.com/wyze/bs-react-testing-library/pull/22)) 14 | * Update CI to try and work better ([@wyze](https://github.com/wyze) in [#21](https://github.com/wyze/bs-react-testing-library/pull/21)) 15 | 16 | ### [v0.7.2](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.7.2) (2020-04-13) 17 | 18 | * Fix bsconfig.json to allow `test` command to run ([@wyze](https://github.com/wyze) in [48b5343](https://github.com/wyze/bs-react-testing-library/commit/48b5343)) 19 | * Run bisect conditionally ([@wyze](https://github.com/wyze) in [#20](https://github.com/wyze/bs-react-testing-library/pull/20)) 20 | 21 | ### [v0.7.1](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.7.1) (2020-04-12) 22 | 23 | * Add support for `act` helper function ([@jihchi](https://github.com/jihchi) in [#17](https://github.com/wyze/bs-react-testing-library/pull/17)) 24 | * Switch to GitHub actions ([@wyze](https://github.com/wyze) in [#18](https://github.com/wyze/bs-react-testing-library/pull/18)) 25 | 26 | ### [v0.7.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.7.0) (2020-04-10) 27 | 28 | * Fix linguist to map files to Reason ([@wyze](https://github.com/wyze) in [ef9fb26](https://github.com/wyze/bs-react-testing-library/commit/ef9fb26)) 29 | * Upgrade devDependencies to latest versions ([@wyze](https://github.com/wyze) in [b4705a9](https://github.com/wyze/bs-react-testing-library/commit/b4705a9)) 30 | * Upgrade underlaying library ([@jihchi](https://github.com/jihchi) in [#13](https://github.com/wyze/bs-react-testing-library/pull/13)) 31 | * Remove warnings for implicit external names ([@justinba1010](https://github.com/justinba1010) in [#9](https://github.com/wyze/bs-react-testing-library/pull/9)) 32 | 33 | ### [v0.6.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.6.0) (2019-07-21) 34 | 35 | * Upgrade `extend` to fix CVE-2018-16492 ([@wyze](https://github.com/wyze) in [535d526](https://github.com/wyze/bs-react-testing-library/commit/535d526)) 36 | * Upgrade dependencies ([@wyze](https://github.com/wyze) in [5a73fe3](https://github.com/wyze/bs-react-testing-library/commit/5a73fe3)) 37 | * Upgrade react-testing-library to v8 ([@jihchi](https://github.com/jihchi) in [#5](https://github.com/wyze/bs-react-testing-library/pull/5)) 38 | 39 | ### [v0.5.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.5.0) (2019-04-24) 40 | 41 | * Meta file updates ([@wyze](https://github.com/wyze) in [9e91c93](https://github.com/wyze/bs-react-testing-library/commit/9e91c93)) 42 | * Fix `FireEvent` module ([@wyze](https://github.com/wyze) in [2e709fd](https://github.com/wyze/bs-react-testing-library/commit/2e709fd)) 43 | * Upgrade dependencies ([@wyze](https://github.com/wyze) in [cd924da](https://github.com/wyze/bs-react-testing-library/commit/cd924da)) 44 | * Improve readme example ([@benadamstyles](https://github.com/benadamstyles) in [#2](https://github.com/wyze/bs-react-testing-library/pull/2)) 45 | 46 | ### [v0.4.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.4.0) (2018-10-11) 47 | 48 | * [[`0ce29af4d8`](https://github.com/wyze/bs-react-testing-library/commit/0ce29af4d8)] - Remove non-functioning Simulate module (Neil Kistner) 49 | * [[`7b2350237a`](https://github.com/wyze/bs-react-testing-library/commit/7b2350237a)] - Upgrade dependencies and expose FireEvent from `bs-dom-testing-library` (Neil Kistner) 50 | 51 | ### [v0.3.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.3.0) (2018-09-20) 52 | 53 | * [[`a92da35f6f`](https://github.com/wyze/bs-react-testing-library/commit/a92da35f6f)] - Meta file updates (Neil Kistner) 54 | * [[`78128d354b`](https://github.com/wyze/bs-react-testing-library/commit/78128d354b)] - Update API with new queries from bs-dom-testing-library (Neil Kistner) 55 | * [[`bb5082301a`](https://github.com/wyze/bs-react-testing-library/commit/bb5082301a)] - Upgrade dependencies (Neil Kistner) 56 | 57 | ### [v0.2.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.2.0) (2018-07-29) 58 | 59 | * [[`e515c3437d`](https://github.com/wyze/bs-react-testing-library/commit/e515c3437d)] - Upgrade dependencies and code to go with it (Neil Kistner) 60 | * [[`7efd67d19e`](https://github.com/wyze/bs-react-testing-library/commit/7efd67d19e)] - Remove unused code in test (Neil Kistner) 61 | * [[`6a4ac2804f`](https://github.com/wyze/bs-react-testing-library/commit/6a4ac2804f)] - Update readme with proper usage (Neil Kistner) 62 | 63 | ### [v0.1.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.1.0) (2018-06-05) 64 | 65 | * [[`7dd8119705`](https://github.com/wyze/bs-react-testing-library/commit/7dd8119705)] - Initial commit (Neil Kistner) 66 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Neil Kistner (neilkistner.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bs-react-testing-library", 3 | "version": "0.8.0", 4 | "description": "BuckleScript bindings for react-testing-library.", 5 | "repository": "wyze/bs-react-testing-library", 6 | "author": { 7 | "name": "Neil Kistner", 8 | "email": "neil.kistner@gmail.com", 9 | "url": "https://neilkistner.com" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "src/*.re", 14 | "src/*.rei", 15 | "bsconfig.json" 16 | ], 17 | "scripts": { 18 | "build": "bsb -make-world", 19 | "clean": "run-p clean:*", 20 | "clean:bsb": "bsb -clean-world", 21 | "clean:project": "rimraf _coverage lib .merlin *.coverage", 22 | "jest": "jest --setupTestFrameworkScriptFile=./setupTests.js", 23 | "postversion": "github-release", 24 | "prebuild": "yarn clean", 25 | "pretest": "yarn build", 26 | "preversion": "yarn build", 27 | "test": "yarn jest", 28 | "test:coverage": "BISECT_ENABLE=yes yarn test", 29 | "version": "changelog" 30 | }, 31 | "keywords": [ 32 | "bucklescript", 33 | "react", 34 | "testing" 35 | ], 36 | "dependencies": { 37 | "@testing-library/react": "^11.1.0", 38 | "bs-dom-testing-library": "^0.7.0" 39 | }, 40 | "peerDependencies": { 41 | "reason-react": "< 0.8.0" 42 | }, 43 | "devDependencies": { 44 | "@glennsl/bs-jest": "^0.5.1", 45 | "@sheerun/mutationobserver-shim": "^0.3.3", 46 | "@wyze/changelog": "^1.0.0", 47 | "@wyze/github-release": "^1.1.1", 48 | "bisect_ppx": "^2.5.0", 49 | "bs-platform": "^8.3.1", 50 | "npm-run-all": "^4.1.5", 51 | "react": "^17.0.0", 52 | "react-dom": "^17.0.0", 53 | "reason-react": "^0.9.1", 54 | "rimraf": "^3.0.2" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # bs-react-testing-library · [![Build Status][actions-image]][actions-url] [![npm][npm-image]][npm-url] [![Codecov][codecov-image]][codecov-url] 2 | 3 | > [BuckleScript](//github.com/BuckleScript/bucklescript) bindings for [react-testing-library](//github.com/kentcdodds/react-testing-library). 4 | 5 | ## Documentation 6 | 7 | [**Read the docs**](//testing-library.com/docs/bs-react-testing-library/intro) | [Edit the docs](//github.com/alexkrolick/testing-library-docs) 8 | 9 | ## Installation 10 | 11 | ```sh 12 | $ yarn add --dev bs-react-testing-library 13 | 14 | # or.. 15 | 16 | $ npm install --save-dev bs-react-testing-library 17 | ``` 18 | 19 | ## Usage 20 | 21 | #### Add to `bsconfig.json` 22 | 23 | ```json 24 | { 25 | "bs-dev-dependencies": [ 26 | "bs-react-testing-library" 27 | ] 28 | } 29 | ``` 30 | 31 | #### With [`bs-jest`](//github.com/glennsl/bs-jest) 32 | 33 | ```ocaml 34 | /* Component_test.re */ 35 | 36 | open Jest; 37 | open Expect; 38 | open ReactTestingLibrary; 39 | 40 | test("Component renders", () => 41 |
42 |

{ReasonReact.string("Heading")}

43 |
44 | |> render 45 | |> container 46 | |> expect 47 | |> toMatchSnapshot 48 | ); 49 | ``` 50 | 51 | ## Examples 52 | 53 | See [`src/__tests__`](src/__tests__) for some examples. 54 | 55 | ## Development 56 | 57 | ```sh 58 | $ git clone https://github.com/wyze/bs-react-testing-library.git 59 | $ cd bs-react-testing-library 60 | $ yarn # or `npm install` 61 | ``` 62 | 63 | ## Build 64 | 65 | ```sh 66 | $ yarn build 67 | ``` 68 | 69 | ## Test 70 | 71 | ```sh 72 | $ yarn test 73 | ``` 74 | 75 | ## Change Log 76 | 77 | > [Full Change Log](changelog.md) 78 | 79 | ### [v0.8.0](https://github.com/wyze/bs-react-testing-library/releases/tag/v0.8.0) (2020-10-21) 80 | 81 | * Upgrade to latest dependencies ([@wyze](https://github.com/wyze) in [#27](https://github.com/wyze/bs-react-testing-library/pull/27)) 82 | * Add sponsor button ([@wyze](https://github.com/wyze) in [c69f028](https://github.com/wyze/bs-react-testing-library/commit/c69f028)) 83 | 84 | ## License 85 | 86 | MIT © [Neil Kistner](https://neilkistner.com) 87 | 88 | [actions-image]: https://img.shields.io/github/workflow/status/wyze/bs-react-testing-library/CI.svg?style=flat-square 89 | [actions-url]: https://github.com/wyze/bs-react-testing-library/actions 90 | 91 | [npm-image]: https://img.shields.io/npm/v/bs-react-testing-library.svg?style=flat-square 92 | [npm-url]: https://npm.im/bs-react-testing-library 93 | 94 | [codecov-image]: https://img.shields.io/codecov/c/github/wyze/bs-react-testing-library.svg?style=flat-square 95 | [codecov-url]: https://codecov.io/github/wyze/bs-react-testing-library 96 | -------------------------------------------------------------------------------- /setupTests.js: -------------------------------------------------------------------------------- 1 | const MutationObserver = require('@sheerun/mutationobserver-shim'); 2 | 3 | window.MutationObserver = MutationObserver; 4 | -------------------------------------------------------------------------------- /src/ReactTestingLibrary.re: -------------------------------------------------------------------------------- 1 | open DomTestingLibrary; 2 | 3 | module FireEvent = { 4 | include FireEvent; 5 | }; 6 | 7 | type renderResult; 8 | type queries; 9 | type renderOptions = { 10 | . 11 | "container": Js.undefined(Dom.element), 12 | "baseElement": Js.undefined(Dom.element), 13 | "hydrate": Js.undefined(bool), 14 | "wrapper": Js.undefined(Dom.element), 15 | "queries": Js.undefined(queries), 16 | }; 17 | 18 | [@bs.module "@testing-library/react"] 19 | external cleanup: unit => unit = "cleanup"; 20 | 21 | [@bs.module "@testing-library/react"] 22 | external _act: (unit => Js.undefined(Js.Promise.t('a))) => unit = "act"; 23 | 24 | let act = callback => 25 | _act(() => { 26 | callback(); 27 | // (work-around) BuckleScript compiles `unit` to `0`, this will cause a warning as following: 28 | // Warning: The callback passed to act(...) function must return undefined, or a Promise. 29 | Js.Undefined.empty; 30 | }); 31 | 32 | [@bs.module "@testing-library/react"] 33 | external _render: (ReasonReact.reactElement, renderOptions) => renderResult = 34 | "render"; 35 | 36 | [@bs.get] external container: renderResult => Dom.element = "container"; 37 | 38 | [@bs.get] external baseElement: renderResult => Dom.element = "baseElement"; 39 | 40 | [@bs.send.pipe: renderResult] 41 | external _debug: (Js.undefined(Dom.element), Js.undefined(int)) => unit = 42 | "debug"; 43 | 44 | [@bs.send.pipe: renderResult] external unmount: unit => bool = "unmount"; 45 | 46 | [@bs.send.pipe: renderResult] 47 | external rerender: ReasonReact.reactElement => unit = "rerender"; 48 | 49 | [@bs.send.pipe: renderResult] 50 | external asFragment: unit => Dom.element = "asFragment"; 51 | 52 | // ByLabelText 53 | [@bs.send.pipe: renderResult] 54 | external _getByLabelText: 55 | ( 56 | ~matcher: [@bs.unwrap] [ 57 | | `Str(string) 58 | | `RegExp(Js.Re.t) 59 | | `Func((string, Dom.element) => bool) 60 | ], 61 | ~options: Js.undefined(ByLabelTextQuery.options) 62 | ) => 63 | Dom.element = 64 | "getByLabelText"; 65 | 66 | let getByLabelText = (~matcher, ~options=?, result) => 67 | _getByLabelText( 68 | result, 69 | ~matcher, 70 | ~options=Js.Undefined.fromOption(options), 71 | ); 72 | 73 | [@bs.send.pipe: renderResult] 74 | external _getAllByLabelText: 75 | ( 76 | ~matcher: [@bs.unwrap] [ 77 | | `Str(string) 78 | | `RegExp(Js.Re.t) 79 | | `Func((string, Dom.element) => bool) 80 | ], 81 | ~options: Js.undefined(ByLabelTextQuery.options) 82 | ) => 83 | array(Dom.element) = 84 | "getAllByLabelText"; 85 | 86 | let getAllByLabelText = (~matcher, ~options=?, result) => 87 | _getAllByLabelText( 88 | result, 89 | ~matcher, 90 | ~options=Js.Undefined.fromOption(options), 91 | ); 92 | 93 | [@bs.send.pipe: renderResult] 94 | external _queryByLabelText: 95 | ( 96 | ~matcher: [@bs.unwrap] [ 97 | | `Str(string) 98 | | `RegExp(Js.Re.t) 99 | | `Func((string, Dom.element) => bool) 100 | ], 101 | ~options: Js.undefined(ByLabelTextQuery.options) 102 | ) => 103 | Js.null(Dom.element) = 104 | "queryByLabelText"; 105 | 106 | let queryByLabelText = (~matcher, ~options=?, result) => 107 | _queryByLabelText( 108 | result, 109 | ~matcher, 110 | ~options=Js.Undefined.fromOption(options), 111 | ); 112 | 113 | [@bs.send.pipe: renderResult] 114 | external _queryAllByLabelText: 115 | ( 116 | ~matcher: [@bs.unwrap] [ 117 | | `Str(string) 118 | | `RegExp(Js.Re.t) 119 | | `Func((string, Dom.element) => bool) 120 | ], 121 | ~options: Js.undefined(ByLabelTextQuery.options) 122 | ) => 123 | array(Dom.element) = 124 | "queryAllByLabelText"; 125 | 126 | let queryAllByLabelText = (~matcher, ~options=?, result) => 127 | _queryAllByLabelText( 128 | result, 129 | ~matcher, 130 | ~options=Js.Undefined.fromOption(options), 131 | ); 132 | 133 | [@bs.send.pipe: renderResult] 134 | external _findByLabelText: 135 | ( 136 | ~matcher: [@bs.unwrap] [ 137 | | `Str(string) 138 | | `RegExp(Js.Re.t) 139 | | `Func((string, Dom.element) => bool) 140 | ], 141 | ~options: Js.undefined(ByLabelTextQuery.options) 142 | ) => 143 | Js.Promise.t(Dom.element) = 144 | "findByLabelText"; 145 | 146 | let findByLabelText = (~matcher, ~options=?, result) => 147 | _findByLabelText( 148 | result, 149 | ~matcher, 150 | ~options=Js.Undefined.fromOption(options), 151 | ); 152 | 153 | [@bs.send.pipe: renderResult] 154 | external _findAllByLabelText: 155 | ( 156 | ~matcher: [@bs.unwrap] [ 157 | | `Str(string) 158 | | `RegExp(Js.Re.t) 159 | | `Func((string, Dom.element) => bool) 160 | ], 161 | ~options: Js.undefined(ByLabelTextQuery.options) 162 | ) => 163 | Js.Promise.t(array(Dom.element)) = 164 | "findAllByLabelText"; 165 | 166 | let findAllByLabelText = (~matcher, ~options=?, result) => 167 | _findAllByLabelText( 168 | result, 169 | ~matcher, 170 | ~options=Js.Undefined.fromOption(options), 171 | ); 172 | 173 | // ByPlaceholderText 174 | [@bs.send.pipe: renderResult] 175 | external _getByPlaceholderText: 176 | ( 177 | ~matcher: [@bs.unwrap] [ 178 | | `Str(string) 179 | | `RegExp(Js.Re.t) 180 | | `Func((string, Dom.element) => bool) 181 | ], 182 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 183 | ) => 184 | Dom.element = 185 | "getByPlaceholderText"; 186 | 187 | let getByPlaceholderText = (~matcher, ~options=?, result) => 188 | _getByPlaceholderText( 189 | result, 190 | ~matcher, 191 | ~options=Js.Undefined.fromOption(options), 192 | ); 193 | 194 | [@bs.send.pipe: renderResult] 195 | external _getAllByPlaceholderText: 196 | ( 197 | ~matcher: [@bs.unwrap] [ 198 | | `Str(string) 199 | | `RegExp(Js.Re.t) 200 | | `Func((string, Dom.element) => bool) 201 | ], 202 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 203 | ) => 204 | array(Dom.element) = 205 | "getAllByPlaceholderText"; 206 | 207 | let getAllByPlaceholderText = (~matcher, ~options=?, result) => 208 | _getAllByPlaceholderText( 209 | result, 210 | ~matcher, 211 | ~options=Js.Undefined.fromOption(options), 212 | ); 213 | 214 | [@bs.send.pipe: renderResult] 215 | external _queryByPlaceholderText: 216 | ( 217 | ~matcher: [@bs.unwrap] [ 218 | | `Str(string) 219 | | `RegExp(Js.Re.t) 220 | | `Func((string, Dom.element) => bool) 221 | ], 222 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 223 | ) => 224 | Js.null(Dom.element) = 225 | "queryByPlaceholderText"; 226 | 227 | let queryByPlaceholderText = (~matcher, ~options=?, result) => 228 | _queryByPlaceholderText( 229 | result, 230 | ~matcher, 231 | ~options=Js.Undefined.fromOption(options), 232 | ); 233 | 234 | [@bs.send.pipe: renderResult] 235 | external _queryAllByPlaceholderText: 236 | ( 237 | ~matcher: [@bs.unwrap] [ 238 | | `Str(string) 239 | | `RegExp(Js.Re.t) 240 | | `Func((string, Dom.element) => bool) 241 | ], 242 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 243 | ) => 244 | array(Dom.element) = 245 | "queryAllByPlaceholderText"; 246 | 247 | let queryAllByPlaceholderText = (~matcher, ~options=?, result) => 248 | _queryAllByPlaceholderText( 249 | result, 250 | ~matcher, 251 | ~options=Js.Undefined.fromOption(options), 252 | ); 253 | 254 | [@bs.send.pipe: renderResult] 255 | external _findByPlaceholderText: 256 | ( 257 | ~matcher: [@bs.unwrap] [ 258 | | `Str(string) 259 | | `RegExp(Js.Re.t) 260 | | `Func((string, Dom.element) => bool) 261 | ], 262 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 263 | ) => 264 | Js.Promise.t(Dom.element) = 265 | "findByPlaceholderText"; 266 | 267 | let findByPlaceholderText = (~matcher, ~options=?, result) => 268 | _findByPlaceholderText( 269 | result, 270 | ~matcher, 271 | ~options=Js.Undefined.fromOption(options), 272 | ); 273 | 274 | [@bs.send.pipe: renderResult] 275 | external _findAllByPlaceholderText: 276 | ( 277 | ~matcher: [@bs.unwrap] [ 278 | | `Str(string) 279 | | `RegExp(Js.Re.t) 280 | | `Func((string, Dom.element) => bool) 281 | ], 282 | ~options: Js.undefined(ByPlaceholderTextQuery.options) 283 | ) => 284 | Js.Promise.t(array(Dom.element)) = 285 | "findAllByPlaceholderText"; 286 | 287 | let findAllByPlaceholderText = (~matcher, ~options=?, result) => 288 | _findAllByPlaceholderText( 289 | result, 290 | ~matcher, 291 | ~options=Js.Undefined.fromOption(options), 292 | ); 293 | 294 | // ByText 295 | [@bs.send.pipe: renderResult] 296 | external _getByText: 297 | ( 298 | ~matcher: [@bs.unwrap] [ 299 | | `Str(string) 300 | | `RegExp(Js.Re.t) 301 | | `Func((string, Dom.element) => bool) 302 | ], 303 | ~options: Js.undefined(ByTextQuery.options) 304 | ) => 305 | Dom.element = 306 | "getByText"; 307 | 308 | let getByText = (~matcher, ~options=?, result) => 309 | _getByText(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 310 | 311 | [@bs.send.pipe: renderResult] 312 | external _getAllByText: 313 | ( 314 | ~matcher: [@bs.unwrap] [ 315 | | `Str(string) 316 | | `RegExp(Js.Re.t) 317 | | `Func((string, Dom.element) => bool) 318 | ], 319 | ~options: Js.undefined(ByTextQuery.options) 320 | ) => 321 | array(Dom.element) = 322 | "getAllByText"; 323 | 324 | let getAllByText = (~matcher, ~options=?, result) => 325 | _getAllByText(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 326 | 327 | [@bs.send.pipe: renderResult] 328 | external _queryByText: 329 | ( 330 | ~matcher: [@bs.unwrap] [ 331 | | `Str(string) 332 | | `RegExp(Js.Re.t) 333 | | `Func((string, Dom.element) => bool) 334 | ], 335 | ~options: Js.undefined(ByTextQuery.options) 336 | ) => 337 | Js.null(Dom.element) = 338 | "queryByText"; 339 | 340 | let queryByText = (~matcher, ~options=?, result) => 341 | _queryByText(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 342 | 343 | [@bs.send.pipe: renderResult] 344 | external _queryAllByText: 345 | ( 346 | ~matcher: [@bs.unwrap] [ 347 | | `Str(string) 348 | | `RegExp(Js.Re.t) 349 | | `Func((string, Dom.element) => bool) 350 | ], 351 | ~options: Js.undefined(ByTextQuery.options) 352 | ) => 353 | array(Dom.element) = 354 | "queryAllByText"; 355 | 356 | let queryAllByText = (~matcher, ~options=?, result) => 357 | _queryAllByText( 358 | result, 359 | ~matcher, 360 | ~options=Js.Undefined.fromOption(options), 361 | ); 362 | 363 | [@bs.send.pipe: renderResult] 364 | external _findByText: 365 | ( 366 | ~matcher: [@bs.unwrap] [ 367 | | `Str(string) 368 | | `RegExp(Js.Re.t) 369 | | `Func((string, Dom.element) => bool) 370 | ], 371 | ~options: Js.undefined(ByTextQuery.options) 372 | ) => 373 | Js.Promise.t(Dom.element) = 374 | "findByText"; 375 | 376 | let findByText = (~matcher, ~options=?, result) => 377 | _findByText(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 378 | 379 | [@bs.send.pipe: renderResult] 380 | external _findAllByText: 381 | ( 382 | ~matcher: [@bs.unwrap] [ 383 | | `Str(string) 384 | | `RegExp(Js.Re.t) 385 | | `Func((string, Dom.element) => bool) 386 | ], 387 | ~options: Js.undefined(ByTextQuery.options) 388 | ) => 389 | Js.Promise.t(array(Dom.element)) = 390 | "findAllByText"; 391 | 392 | let findAllByText = (~matcher, ~options=?, result) => 393 | _findAllByText( 394 | result, 395 | ~matcher, 396 | ~options=Js.Undefined.fromOption(options), 397 | ); 398 | 399 | // ByAltText 400 | [@bs.send.pipe: renderResult] 401 | external _getByAltText: 402 | ( 403 | ~matcher: [@bs.unwrap] [ 404 | | `Str(string) 405 | | `RegExp(Js.Re.t) 406 | | `Func((string, Dom.element) => bool) 407 | ], 408 | ~options: Js.undefined(ByAltTextQuery.options) 409 | ) => 410 | Dom.element = 411 | "getByAltText"; 412 | 413 | let getByAltText = (~matcher, ~options=?, result) => 414 | _getByAltText(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 415 | 416 | [@bs.send.pipe: renderResult] 417 | external _getAllByAltText: 418 | ( 419 | ~matcher: [@bs.unwrap] [ 420 | | `Str(string) 421 | | `RegExp(Js.Re.t) 422 | | `Func((string, Dom.element) => bool) 423 | ], 424 | ~options: Js.undefined(ByAltTextQuery.options) 425 | ) => 426 | array(Dom.element) = 427 | "getAllByAltText"; 428 | 429 | let getAllByAltText = (~matcher, ~options=?, result) => 430 | _getAllByAltText( 431 | result, 432 | ~matcher, 433 | ~options=Js.Undefined.fromOption(options), 434 | ); 435 | 436 | [@bs.send.pipe: renderResult] 437 | external _queryByAltText: 438 | ( 439 | ~matcher: [@bs.unwrap] [ 440 | | `Str(string) 441 | | `RegExp(Js.Re.t) 442 | | `Func((string, Dom.element) => bool) 443 | ], 444 | ~options: Js.undefined(ByAltTextQuery.options) 445 | ) => 446 | Js.null(Dom.element) = 447 | "queryByAltText"; 448 | 449 | let queryByAltText = (~matcher, ~options=?, result) => 450 | _queryByAltText( 451 | result, 452 | ~matcher, 453 | ~options=Js.Undefined.fromOption(options), 454 | ); 455 | 456 | [@bs.send.pipe: renderResult] 457 | external _queryAllByAltText: 458 | ( 459 | ~matcher: [@bs.unwrap] [ 460 | | `Str(string) 461 | | `RegExp(Js.Re.t) 462 | | `Func((string, Dom.element) => bool) 463 | ], 464 | ~options: Js.undefined(ByAltTextQuery.options) 465 | ) => 466 | array(Dom.element) = 467 | "queryAllByAltText"; 468 | 469 | let queryAllByAltText = (~matcher, ~options=?, result) => 470 | _queryAllByAltText( 471 | result, 472 | ~matcher, 473 | ~options=Js.Undefined.fromOption(options), 474 | ); 475 | 476 | [@bs.send.pipe: renderResult] 477 | external _findByAltText: 478 | ( 479 | ~matcher: [@bs.unwrap] [ 480 | | `Str(string) 481 | | `RegExp(Js.Re.t) 482 | | `Func((string, Dom.element) => bool) 483 | ], 484 | ~options: Js.undefined(ByAltTextQuery.options) 485 | ) => 486 | Js.Promise.t(Dom.element) = 487 | "findByAltText"; 488 | 489 | let findByAltText = (~matcher, ~options=?, result) => 490 | _findByAltText( 491 | result, 492 | ~matcher, 493 | ~options=Js.Undefined.fromOption(options), 494 | ); 495 | 496 | [@bs.send.pipe: renderResult] 497 | external _findAllByAltText: 498 | ( 499 | ~matcher: [@bs.unwrap] [ 500 | | `Str(string) 501 | | `RegExp(Js.Re.t) 502 | | `Func((string, Dom.element) => bool) 503 | ], 504 | ~options: Js.undefined(ByAltTextQuery.options) 505 | ) => 506 | Js.Promise.t(array(Dom.element)) = 507 | "findAllByAltText"; 508 | 509 | let findAllByAltText = (~matcher, ~options=?, result) => 510 | _findAllByAltText( 511 | result, 512 | ~matcher, 513 | ~options=Js.Undefined.fromOption(options), 514 | ); 515 | 516 | // ByTitle 517 | [@bs.send.pipe: renderResult] 518 | external _getByTitle: 519 | ( 520 | ~matcher: [@bs.unwrap] [ 521 | | `Str(string) 522 | | `RegExp(Js.Re.t) 523 | | `Func((string, Dom.element) => bool) 524 | ], 525 | ~options: Js.undefined(ByTitleQuery.options) 526 | ) => 527 | Dom.element = 528 | "getByTitle"; 529 | 530 | let getByTitle = (~matcher, ~options=?, result) => 531 | _getByTitle(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 532 | 533 | [@bs.send.pipe: renderResult] 534 | external _getAllByTitle: 535 | ( 536 | ~matcher: [@bs.unwrap] [ 537 | | `Str(string) 538 | | `RegExp(Js.Re.t) 539 | | `Func((string, Dom.element) => bool) 540 | ], 541 | ~options: Js.undefined(ByTitleQuery.options) 542 | ) => 543 | array(Dom.element) = 544 | "getAllByTitle"; 545 | 546 | let getAllByTitle = (~matcher, ~options=?, result) => 547 | _getAllByTitle( 548 | result, 549 | ~matcher, 550 | ~options=Js.Undefined.fromOption(options), 551 | ); 552 | 553 | [@bs.send.pipe: renderResult] 554 | external _queryByTitle: 555 | ( 556 | ~matcher: [@bs.unwrap] [ 557 | | `Str(string) 558 | | `RegExp(Js.Re.t) 559 | | `Func((string, Dom.element) => bool) 560 | ], 561 | ~options: Js.undefined(ByTitleQuery.options) 562 | ) => 563 | Js.null(Dom.element) = 564 | "queryByTitle"; 565 | 566 | let queryByTitle = (~matcher, ~options=?, result) => 567 | _queryByTitle(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 568 | 569 | [@bs.send.pipe: renderResult] 570 | external _queryAllByTitle: 571 | ( 572 | ~matcher: [@bs.unwrap] [ 573 | | `Str(string) 574 | | `RegExp(Js.Re.t) 575 | | `Func((string, Dom.element) => bool) 576 | ], 577 | ~options: Js.undefined(ByTitleQuery.options) 578 | ) => 579 | array(Dom.element) = 580 | "queryAllByTitle"; 581 | 582 | let queryAllByTitle = (~matcher, ~options=?, result) => 583 | _queryAllByTitle( 584 | result, 585 | ~matcher, 586 | ~options=Js.Undefined.fromOption(options), 587 | ); 588 | 589 | [@bs.send.pipe: renderResult] 590 | external _findByTitle: 591 | ( 592 | ~matcher: [@bs.unwrap] [ 593 | | `Str(string) 594 | | `RegExp(Js.Re.t) 595 | | `Func((string, Dom.element) => bool) 596 | ], 597 | ~options: Js.undefined(ByTitleQuery.options) 598 | ) => 599 | Js.Promise.t(Dom.element) = 600 | "findByTitle"; 601 | 602 | let findByTitle = (~matcher, ~options=?, result) => 603 | _findByTitle(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 604 | 605 | [@bs.send.pipe: renderResult] 606 | external _findAllByTitle: 607 | ( 608 | ~matcher: [@bs.unwrap] [ 609 | | `Str(string) 610 | | `RegExp(Js.Re.t) 611 | | `Func((string, Dom.element) => bool) 612 | ], 613 | ~options: Js.undefined(ByTitleQuery.options) 614 | ) => 615 | Js.Promise.t(array(Dom.element)) = 616 | "findAllByTitle"; 617 | 618 | let findAllByTitle = (~matcher, ~options=?, result) => 619 | _findAllByTitle( 620 | result, 621 | ~matcher, 622 | ~options=Js.Undefined.fromOption(options), 623 | ); 624 | 625 | // ByDisplayValue 626 | [@bs.send.pipe: renderResult] 627 | external _getByDisplayValue: 628 | ( 629 | ~matcher: [@bs.unwrap] [ 630 | | `Str(string) 631 | | `RegExp(Js.Re.t) 632 | | `Func((string, Dom.element) => bool) 633 | ], 634 | ~options: Js.undefined(ByDisplayValueQuery.options) 635 | ) => 636 | Dom.element = 637 | "getByDisplayValue"; 638 | 639 | let getByDisplayValue = (~matcher, ~options=?, result) => 640 | _getByDisplayValue( 641 | result, 642 | ~matcher, 643 | ~options=Js.Undefined.fromOption(options), 644 | ); 645 | 646 | [@bs.send.pipe: renderResult] 647 | external _getAllByDisplayValue: 648 | ( 649 | ~matcher: [@bs.unwrap] [ 650 | | `Str(string) 651 | | `RegExp(Js.Re.t) 652 | | `Func((string, Dom.element) => bool) 653 | ], 654 | ~options: Js.undefined(ByDisplayValueQuery.options) 655 | ) => 656 | array(Dom.element) = 657 | "getAllByDisplayValue"; 658 | 659 | let getAllByDisplayValue = (~matcher, ~options=?, result) => 660 | _getAllByDisplayValue( 661 | result, 662 | ~matcher, 663 | ~options=Js.Undefined.fromOption(options), 664 | ); 665 | 666 | [@bs.send.pipe: renderResult] 667 | external _queryByDisplayValue: 668 | ( 669 | ~matcher: [@bs.unwrap] [ 670 | | `Str(string) 671 | | `RegExp(Js.Re.t) 672 | | `Func((string, Dom.element) => bool) 673 | ], 674 | ~options: Js.undefined(ByDisplayValueQuery.options) 675 | ) => 676 | Js.null(Dom.element) = 677 | "queryByDisplayValue"; 678 | 679 | let queryByDisplayValue = (~matcher, ~options=?, result) => 680 | _queryByDisplayValue( 681 | result, 682 | ~matcher, 683 | ~options=Js.Undefined.fromOption(options), 684 | ); 685 | 686 | [@bs.send.pipe: renderResult] 687 | external _queryAllByDisplayValue: 688 | ( 689 | ~matcher: [@bs.unwrap] [ 690 | | `Str(string) 691 | | `RegExp(Js.Re.t) 692 | | `Func((string, Dom.element) => bool) 693 | ], 694 | ~options: Js.undefined(ByDisplayValueQuery.options) 695 | ) => 696 | array(Dom.element) = 697 | "queryAllByDisplayValue"; 698 | 699 | let queryAllByDisplayValue = (~matcher, ~options=?, result) => 700 | _queryAllByDisplayValue( 701 | result, 702 | ~matcher, 703 | ~options=Js.Undefined.fromOption(options), 704 | ); 705 | 706 | [@bs.send.pipe: renderResult] 707 | external _findByDisplayValue: 708 | ( 709 | ~matcher: [@bs.unwrap] [ 710 | | `Str(string) 711 | | `RegExp(Js.Re.t) 712 | | `Func((string, Dom.element) => bool) 713 | ], 714 | ~options: Js.undefined(ByDisplayValueQuery.options) 715 | ) => 716 | Js.Promise.t(Dom.element) = 717 | "findByDisplayValue"; 718 | 719 | let findByDisplayValue = (~matcher, ~options=?, result) => 720 | _findByDisplayValue( 721 | result, 722 | ~matcher, 723 | ~options=Js.Undefined.fromOption(options), 724 | ); 725 | 726 | [@bs.send.pipe: renderResult] 727 | external _findAllByDisplayValue: 728 | ( 729 | ~matcher: [@bs.unwrap] [ 730 | | `Str(string) 731 | | `RegExp(Js.Re.t) 732 | | `Func((string, Dom.element) => bool) 733 | ], 734 | ~options: Js.undefined(ByDisplayValueQuery.options) 735 | ) => 736 | Js.Promise.t(array(Dom.element)) = 737 | "findAllByDisplayValue"; 738 | 739 | let findAllByDisplayValue = (~matcher, ~options=?, result) => 740 | _findAllByDisplayValue( 741 | result, 742 | ~matcher, 743 | ~options=Js.Undefined.fromOption(options), 744 | ); 745 | 746 | // ByRole 747 | [@bs.send.pipe: renderResult] 748 | external _getByRole: 749 | ( 750 | ~matcher: [@bs.unwrap] [ 751 | | `Str(string) 752 | | `RegExp(Js.Re.t) 753 | | `Func((string, Dom.element) => bool) 754 | ], 755 | ~options: Js.undefined(ByRoleQuery.options) 756 | ) => 757 | Dom.element = 758 | "getByRole"; 759 | 760 | let getByRole = (~matcher, ~options=?, result) => 761 | _getByRole(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 762 | 763 | [@bs.send.pipe: renderResult] 764 | external _getAllByRole: 765 | ( 766 | ~matcher: [@bs.unwrap] [ 767 | | `Str(string) 768 | | `RegExp(Js.Re.t) 769 | | `Func((string, Dom.element) => bool) 770 | ], 771 | ~options: Js.undefined(ByRoleQuery.options) 772 | ) => 773 | array(Dom.element) = 774 | "getAllByRole"; 775 | 776 | let getAllByRole = (~matcher, ~options=?, result) => 777 | _getAllByRole(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 778 | 779 | [@bs.send.pipe: renderResult] 780 | external _queryByRole: 781 | ( 782 | ~matcher: [@bs.unwrap] [ 783 | | `Str(string) 784 | | `RegExp(Js.Re.t) 785 | | `Func((string, Dom.element) => bool) 786 | ], 787 | ~options: Js.undefined(ByRoleQuery.options) 788 | ) => 789 | Js.null(Dom.element) = 790 | "queryByRole"; 791 | 792 | let queryByRole = (~matcher, ~options=?, result) => 793 | _queryByRole(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 794 | 795 | [@bs.send.pipe: renderResult] 796 | external _queryAllByRole: 797 | ( 798 | ~matcher: [@bs.unwrap] [ 799 | | `Str(string) 800 | | `RegExp(Js.Re.t) 801 | | `Func((string, Dom.element) => bool) 802 | ], 803 | ~options: Js.undefined(ByRoleQuery.options) 804 | ) => 805 | array(Dom.element) = 806 | "queryAllByRole"; 807 | 808 | let queryAllByRole = (~matcher, ~options=?, result) => 809 | _queryAllByRole( 810 | result, 811 | ~matcher, 812 | ~options=Js.Undefined.fromOption(options), 813 | ); 814 | 815 | [@bs.send.pipe: renderResult] 816 | external _findByRole: 817 | ( 818 | ~matcher: [@bs.unwrap] [ 819 | | `Str(string) 820 | | `RegExp(Js.Re.t) 821 | | `Func((string, Dom.element) => bool) 822 | ], 823 | ~options: Js.undefined(ByRoleQuery.options) 824 | ) => 825 | Js.Promise.t(Dom.element) = 826 | "findByRole"; 827 | 828 | let findByRole = (~matcher, ~options=?, result) => 829 | _findByRole(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 830 | 831 | [@bs.send.pipe: renderResult] 832 | external _findAllByRole: 833 | ( 834 | ~matcher: [@bs.unwrap] [ 835 | | `Str(string) 836 | | `RegExp(Js.Re.t) 837 | | `Func((string, Dom.element) => bool) 838 | ], 839 | ~options: Js.undefined(ByRoleQuery.options) 840 | ) => 841 | Js.Promise.t(array(Dom.element)) = 842 | "findAllByRole"; 843 | 844 | let findAllByRole = (~matcher, ~options=?, result) => 845 | _findAllByRole( 846 | result, 847 | ~matcher, 848 | ~options=Js.Undefined.fromOption(options), 849 | ); 850 | 851 | // ByTestId 852 | [@bs.send.pipe: renderResult] 853 | external _getByTestId: 854 | ( 855 | ~matcher: [@bs.unwrap] [ 856 | | `Str(string) 857 | | `RegExp(Js.Re.t) 858 | | `Func((string, Dom.element) => bool) 859 | ], 860 | ~options: Js.undefined(ByTestIdQuery.options) 861 | ) => 862 | Dom.element = 863 | "getByTestId"; 864 | 865 | let getByTestId = (~matcher, ~options=?, result) => 866 | _getByTestId(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 867 | 868 | [@bs.send.pipe: renderResult] 869 | external _getAllByTestId: 870 | ( 871 | ~matcher: [@bs.unwrap] [ 872 | | `Str(string) 873 | | `RegExp(Js.Re.t) 874 | | `Func((string, Dom.element) => bool) 875 | ], 876 | ~options: Js.undefined(ByTestIdQuery.options) 877 | ) => 878 | array(Dom.element) = 879 | "getAllByTestId"; 880 | 881 | let getAllByTestId = (~matcher, ~options=?, result) => 882 | _getAllByTestId( 883 | result, 884 | ~matcher, 885 | ~options=Js.Undefined.fromOption(options), 886 | ); 887 | 888 | [@bs.send.pipe: renderResult] 889 | external _queryByTestId: 890 | ( 891 | ~matcher: [@bs.unwrap] [ 892 | | `Str(string) 893 | | `RegExp(Js.Re.t) 894 | | `Func((string, Dom.element) => bool) 895 | ], 896 | ~options: Js.undefined(ByTestIdQuery.options) 897 | ) => 898 | Js.null(Dom.element) = 899 | "queryByTestId"; 900 | 901 | let queryByTestId = (~matcher, ~options=?, result) => 902 | _queryByTestId( 903 | result, 904 | ~matcher, 905 | ~options=Js.Undefined.fromOption(options), 906 | ); 907 | 908 | [@bs.send.pipe: renderResult] 909 | external _queryAllByTestId: 910 | ( 911 | ~matcher: [@bs.unwrap] [ 912 | | `Str(string) 913 | | `RegExp(Js.Re.t) 914 | | `Func((string, Dom.element) => bool) 915 | ], 916 | ~options: Js.undefined(ByTestIdQuery.options) 917 | ) => 918 | array(Dom.element) = 919 | "queryAllByTestId"; 920 | 921 | let queryAllByTestId = (~matcher, ~options=?, result) => 922 | _queryAllByTestId( 923 | result, 924 | ~matcher, 925 | ~options=Js.Undefined.fromOption(options), 926 | ); 927 | 928 | [@bs.send.pipe: renderResult] 929 | external _findByTestId: 930 | ( 931 | ~matcher: [@bs.unwrap] [ 932 | | `Str(string) 933 | | `RegExp(Js.Re.t) 934 | | `Func((string, Dom.element) => bool) 935 | ], 936 | ~options: Js.undefined(ByTestIdQuery.options) 937 | ) => 938 | Js.Promise.t(Dom.element) = 939 | "findByTestId"; 940 | 941 | let findByTestId = (~matcher, ~options=?, result) => 942 | _findByTestId(result, ~matcher, ~options=Js.Undefined.fromOption(options)); 943 | 944 | [@bs.send.pipe: renderResult] 945 | external _findAllByTestId: 946 | ( 947 | ~matcher: [@bs.unwrap] [ 948 | | `Str(string) 949 | | `RegExp(Js.Re.t) 950 | | `Func((string, Dom.element) => bool) 951 | ], 952 | ~options: Js.undefined(ByTestIdQuery.options) 953 | ) => 954 | Js.Promise.t(array(Dom.element)) = 955 | "findAllByTestId"; 956 | 957 | let findAllByTestId = (~matcher, ~options=?, result) => 958 | _findAllByTestId( 959 | result, 960 | ~matcher, 961 | ~options=Js.Undefined.fromOption(options), 962 | ); 963 | 964 | let render = 965 | ( 966 | ~baseElement=?, 967 | ~container=?, 968 | ~hydrate=?, 969 | ~wrapper=?, 970 | ~queries=?, 971 | element, 972 | ) => { 973 | let baseElement_ = 974 | switch (container) { 975 | | Some(container') => Js.Undefined.return(container') 976 | | None => Js.Undefined.fromOption(baseElement) 977 | }; 978 | let container_ = Js.Undefined.fromOption(container); 979 | 980 | _render( 981 | element, 982 | { 983 | "baseElement": baseElement_, 984 | "container": container_, 985 | "hydrate": Js.Undefined.fromOption(hydrate), 986 | "wrapper": Js.Undefined.fromOption(wrapper), 987 | "queries": Js.Undefined.fromOption(queries), 988 | }, 989 | ); 990 | }; 991 | 992 | let debug = (~el=?, ~maxLengthToPrint=?, ()) => 993 | _debug( 994 | Js.Undefined.fromOption(el), 995 | Js.Undefined.fromOption(maxLengthToPrint), 996 | ); 997 | -------------------------------------------------------------------------------- /src/ReactTestingLibrary.rei: -------------------------------------------------------------------------------- 1 | module FireEvent: { 2 | let abort: (~eventInit: Js.t({..})=?, Dom.element) => unit; 3 | let animationEnd: (~eventInit: Js.t({..})=?, Dom.element) => unit; 4 | let animationIteration: (~eventInit: Js.t({..})=?, Dom.element) => unit; 5 | let animationStart: (~eventInit: Js.t({..})=?, Dom.element) => unit; 6 | let blur: (~eventInit: Js.t({..})=?, Dom.element) => unit; 7 | let canPlay: (~eventInit: Js.t({..})=?, Dom.element) => unit; 8 | let canPlayThrough: (~eventInit: Js.t({..})=?, Dom.element) => unit; 9 | let change: (~eventInit: Js.t({..})=?, Dom.element) => unit; 10 | let click: (~eventInit: Js.t({..})=?, Dom.element) => unit; 11 | let compositionEnd: (~eventInit: Js.t({..})=?, Dom.element) => unit; 12 | let compositionStart: (~eventInit: Js.t({..})=?, Dom.element) => unit; 13 | let compositionUpdate: (~eventInit: Js.t({..})=?, Dom.element) => unit; 14 | let contextMenu: (~eventInit: Js.t({..})=?, Dom.element) => unit; 15 | let copy: (~eventInit: Js.t({..})=?, Dom.element) => unit; 16 | let cut: (~eventInit: Js.t({..})=?, Dom.element) => unit; 17 | let dblClick: (~eventInit: Js.t({..})=?, Dom.element) => unit; 18 | let doubleClick: (~eventInit: Js.t({..})=?, Dom.element) => unit; 19 | let drag: (~eventInit: Js.t({..})=?, Dom.element) => unit; 20 | let dragEnd: (~eventInit: Js.t({..})=?, Dom.element) => unit; 21 | let dragEnter: (~eventInit: Js.t({..})=?, Dom.element) => unit; 22 | let dragExit: (~eventInit: Js.t({..})=?, Dom.element) => unit; 23 | let dragLeave: (~eventInit: Js.t({..})=?, Dom.element) => unit; 24 | let dragOver: (~eventInit: Js.t({..})=?, Dom.element) => unit; 25 | let dragStart: (~eventInit: Js.t({..})=?, Dom.element) => unit; 26 | let drop: (~eventInit: Js.t({..})=?, Dom.element) => unit; 27 | let durationChange: (~eventInit: Js.t({..})=?, Dom.element) => unit; 28 | let emptied: (~eventInit: Js.t({..})=?, Dom.element) => unit; 29 | let encrypted: (~eventInit: Js.t({..})=?, Dom.element) => unit; 30 | let ended: (~eventInit: Js.t({..})=?, Dom.element) => unit; 31 | let error: (~eventInit: Js.t({..})=?, Dom.element) => unit; 32 | let focus: (~eventInit: Js.t({..})=?, Dom.element) => unit; 33 | let focusIn: (~eventInit: Js.t({..})=?, Dom.element) => unit; 34 | let focusOut: (~eventInit: Js.t({..})=?, Dom.element) => unit; 35 | let input: (~eventInit: Js.t({..})=?, Dom.element) => unit; 36 | let invalid: (~eventInit: Js.t({..})=?, Dom.element) => unit; 37 | let keyDown: (~eventInit: Js.t({..})=?, Dom.element) => unit; 38 | let keyPress: (~eventInit: Js.t({..})=?, Dom.element) => unit; 39 | let keyUp: (~eventInit: Js.t({..})=?, Dom.element) => unit; 40 | let load: (~eventInit: Js.t({..})=?, Dom.element) => unit; 41 | let loadStart: (~eventInit: Js.t({..})=?, Dom.element) => unit; 42 | let loadedData: (~eventInit: Js.t({..})=?, Dom.element) => unit; 43 | let loadedMetadata: (~eventInit: Js.t({..})=?, Dom.element) => unit; 44 | let mouseDown: (~eventInit: Js.t({..})=?, Dom.element) => unit; 45 | let mouseEnter: (~eventInit: Js.t({..})=?, Dom.element) => unit; 46 | let mouseLeave: (~eventInit: Js.t({..})=?, Dom.element) => unit; 47 | let mouseMove: (~eventInit: Js.t({..})=?, Dom.element) => unit; 48 | let mouseOut: (~eventInit: Js.t({..})=?, Dom.element) => unit; 49 | let mouseOver: (~eventInit: Js.t({..})=?, Dom.element) => unit; 50 | let mouseUp: (~eventInit: Js.t({..})=?, Dom.element) => unit; 51 | let paste: (~eventInit: Js.t({..})=?, Dom.element) => unit; 52 | let pause: (~eventInit: Js.t({..})=?, Dom.element) => unit; 53 | let play: (~eventInit: Js.t({..})=?, Dom.element) => unit; 54 | let playing: (~eventInit: Js.t({..})=?, Dom.element) => unit; 55 | let progress: (~eventInit: Js.t({..})=?, Dom.element) => unit; 56 | let rateChange: (~eventInit: Js.t({..})=?, Dom.element) => unit; 57 | let scroll: (~eventInit: Js.t({..})=?, Dom.element) => unit; 58 | let seeked: (~eventInit: Js.t({..})=?, Dom.element) => unit; 59 | let seeking: (~eventInit: Js.t({..})=?, Dom.element) => unit; 60 | let select: (~eventInit: Js.t({..})=?, Dom.element) => unit; 61 | let stalled: (~eventInit: Js.t({..})=?, Dom.element) => unit; 62 | let submit: (~eventInit: Js.t({..})=?, Dom.element) => unit; 63 | let suspend: (~eventInit: Js.t({..})=?, Dom.element) => unit; 64 | let timeUpdate: (~eventInit: Js.t({..})=?, Dom.element) => unit; 65 | let touchCancel: (~eventInit: Js.t({..})=?, Dom.element) => unit; 66 | let touchEnd: (~eventInit: Js.t({..})=?, Dom.element) => unit; 67 | let touchMove: (~eventInit: Js.t({..})=?, Dom.element) => unit; 68 | let touchStart: (~eventInit: Js.t({..})=?, Dom.element) => unit; 69 | let transitionEnd: (~eventInit: Js.t({..})=?, Dom.element) => unit; 70 | let volumeChange: (~eventInit: Js.t({..})=?, Dom.element) => unit; 71 | let waiting: (~eventInit: Js.t({..})=?, Dom.element) => unit; 72 | let wheel: (~eventInit: Js.t({..})=?, Dom.element) => unit; 73 | }; 74 | 75 | type renderResult; 76 | type queries; 77 | type renderOptions = { 78 | . 79 | "container": Js.undefined(Dom.element), 80 | "baseElement": Js.undefined(Dom.element), 81 | "hydrate": Js.undefined(bool), 82 | "wrapper": Js.undefined(Dom.element), 83 | "queries": Js.undefined(queries), 84 | }; 85 | 86 | [@bs.module "@testing-library/react"] 87 | external cleanup: unit => unit = "cleanup"; 88 | 89 | let act: (unit => unit) => unit; 90 | 91 | [@bs.get] external container: renderResult => Dom.element = "container"; 92 | 93 | [@bs.get] external baseElement: renderResult => Dom.element = "baseElement"; 94 | 95 | [@bs.send.pipe: renderResult] external unmount: unit => bool = "unmount"; 96 | 97 | [@bs.send.pipe: renderResult] 98 | external asFragment: unit => Dom.element = "asFragment"; 99 | 100 | // ByLabelText 101 | let getByLabelText: 102 | ( 103 | ~matcher: [ 104 | | `Func((string, Dom.element) => bool) 105 | | `RegExp(Js.Re.t) 106 | | `Str(string) 107 | ], 108 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 109 | renderResult 110 | ) => 111 | Dom.element; 112 | 113 | let getAllByLabelText: 114 | ( 115 | ~matcher: [ 116 | | `Func((string, Dom.element) => bool) 117 | | `RegExp(Js.Re.t) 118 | | `Str(string) 119 | ], 120 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 121 | renderResult 122 | ) => 123 | array(Dom.element); 124 | 125 | let queryByLabelText: 126 | ( 127 | ~matcher: [ 128 | | `Func((string, Dom.element) => bool) 129 | | `RegExp(Js.Re.t) 130 | | `Str(string) 131 | ], 132 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 133 | renderResult 134 | ) => 135 | Js.null(Dom.element); 136 | 137 | let queryAllByLabelText: 138 | ( 139 | ~matcher: [ 140 | | `Func((string, Dom.element) => bool) 141 | | `RegExp(Js.Re.t) 142 | | `Str(string) 143 | ], 144 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 145 | renderResult 146 | ) => 147 | array(Dom.element); 148 | 149 | let findByLabelText: 150 | ( 151 | ~matcher: [ 152 | | `Func((string, Dom.element) => bool) 153 | | `RegExp(Js.Re.t) 154 | | `Str(string) 155 | ], 156 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 157 | renderResult 158 | ) => 159 | Js.Promise.t(Dom.element); 160 | 161 | let findAllByLabelText: 162 | ( 163 | ~matcher: [ 164 | | `Func((string, Dom.element) => bool) 165 | | `RegExp(Js.Re.t) 166 | | `Str(string) 167 | ], 168 | ~options: DomTestingLibrary.ByLabelTextQuery.options=?, 169 | renderResult 170 | ) => 171 | Js.Promise.t(array(Dom.element)); 172 | 173 | // ByPlaceholderText 174 | let getByPlaceholderText: 175 | ( 176 | ~matcher: [ 177 | | `Func((string, Dom.element) => bool) 178 | | `RegExp(Js.Re.t) 179 | | `Str(string) 180 | ], 181 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 182 | renderResult 183 | ) => 184 | Dom.element; 185 | 186 | let getAllByPlaceholderText: 187 | ( 188 | ~matcher: [ 189 | | `Func((string, Dom.element) => bool) 190 | | `RegExp(Js.Re.t) 191 | | `Str(string) 192 | ], 193 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 194 | renderResult 195 | ) => 196 | array(Dom.element); 197 | 198 | let queryByPlaceholderText: 199 | ( 200 | ~matcher: [ 201 | | `Func((string, Dom.element) => bool) 202 | | `RegExp(Js.Re.t) 203 | | `Str(string) 204 | ], 205 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 206 | renderResult 207 | ) => 208 | Js.null(Dom.element); 209 | 210 | let queryAllByPlaceholderText: 211 | ( 212 | ~matcher: [ 213 | | `Func((string, Dom.element) => bool) 214 | | `RegExp(Js.Re.t) 215 | | `Str(string) 216 | ], 217 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 218 | renderResult 219 | ) => 220 | array(Dom.element); 221 | 222 | let findByPlaceholderText: 223 | ( 224 | ~matcher: [ 225 | | `Func((string, Dom.element) => bool) 226 | | `RegExp(Js.Re.t) 227 | | `Str(string) 228 | ], 229 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 230 | renderResult 231 | ) => 232 | Js.Promise.t(Dom.element); 233 | 234 | let findAllByPlaceholderText: 235 | ( 236 | ~matcher: [ 237 | | `Func((string, Dom.element) => bool) 238 | | `RegExp(Js.Re.t) 239 | | `Str(string) 240 | ], 241 | ~options: DomTestingLibrary.ByPlaceholderTextQuery.options=?, 242 | renderResult 243 | ) => 244 | Js.Promise.t(array(Dom.element)); 245 | 246 | // ByText 247 | let getByText: 248 | ( 249 | ~matcher: [ 250 | | `Func((string, Dom.element) => bool) 251 | | `RegExp(Js.Re.t) 252 | | `Str(string) 253 | ], 254 | ~options: DomTestingLibrary.ByTextQuery.options=?, 255 | renderResult 256 | ) => 257 | Dom.element; 258 | 259 | let getAllByText: 260 | ( 261 | ~matcher: [ 262 | | `Func((string, Dom.element) => bool) 263 | | `RegExp(Js.Re.t) 264 | | `Str(string) 265 | ], 266 | ~options: DomTestingLibrary.ByTextQuery.options=?, 267 | renderResult 268 | ) => 269 | array(Dom.element); 270 | 271 | let queryByText: 272 | ( 273 | ~matcher: [ 274 | | `Func((string, Dom.element) => bool) 275 | | `RegExp(Js.Re.t) 276 | | `Str(string) 277 | ], 278 | ~options: DomTestingLibrary.ByTextQuery.options=?, 279 | renderResult 280 | ) => 281 | Js.null(Dom.element); 282 | 283 | let queryAllByText: 284 | ( 285 | ~matcher: [ 286 | | `Func((string, Dom.element) => bool) 287 | | `RegExp(Js.Re.t) 288 | | `Str(string) 289 | ], 290 | ~options: DomTestingLibrary.ByTextQuery.options=?, 291 | renderResult 292 | ) => 293 | array(Dom.element); 294 | 295 | let findByText: 296 | ( 297 | ~matcher: [ 298 | | `Func((string, Dom.element) => bool) 299 | | `RegExp(Js.Re.t) 300 | | `Str(string) 301 | ], 302 | ~options: DomTestingLibrary.ByTextQuery.options=?, 303 | renderResult 304 | ) => 305 | Js.Promise.t(Dom.element); 306 | 307 | let findAllByText: 308 | ( 309 | ~matcher: [ 310 | | `Func((string, Dom.element) => bool) 311 | | `RegExp(Js.Re.t) 312 | | `Str(string) 313 | ], 314 | ~options: DomTestingLibrary.ByTextQuery.options=?, 315 | renderResult 316 | ) => 317 | Js.Promise.t(array(Dom.element)); 318 | 319 | // ByAltText 320 | let getByAltText: 321 | ( 322 | ~matcher: [ 323 | | `Func((string, Dom.element) => bool) 324 | | `RegExp(Js.Re.t) 325 | | `Str(string) 326 | ], 327 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 328 | renderResult 329 | ) => 330 | Dom.element; 331 | 332 | let getAllByAltText: 333 | ( 334 | ~matcher: [ 335 | | `Func((string, Dom.element) => bool) 336 | | `RegExp(Js.Re.t) 337 | | `Str(string) 338 | ], 339 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 340 | renderResult 341 | ) => 342 | array(Dom.element); 343 | 344 | let queryByAltText: 345 | ( 346 | ~matcher: [ 347 | | `Func((string, Dom.element) => bool) 348 | | `RegExp(Js.Re.t) 349 | | `Str(string) 350 | ], 351 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 352 | renderResult 353 | ) => 354 | Js.null(Dom.element); 355 | 356 | let queryAllByAltText: 357 | ( 358 | ~matcher: [ 359 | | `Func((string, Dom.element) => bool) 360 | | `RegExp(Js.Re.t) 361 | | `Str(string) 362 | ], 363 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 364 | renderResult 365 | ) => 366 | array(Dom.element); 367 | 368 | let findByAltText: 369 | ( 370 | ~matcher: [ 371 | | `Func((string, Dom.element) => bool) 372 | | `RegExp(Js.Re.t) 373 | | `Str(string) 374 | ], 375 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 376 | renderResult 377 | ) => 378 | Js.Promise.t(Dom.element); 379 | 380 | let findAllByAltText: 381 | ( 382 | ~matcher: [ 383 | | `Func((string, Dom.element) => bool) 384 | | `RegExp(Js.Re.t) 385 | | `Str(string) 386 | ], 387 | ~options: DomTestingLibrary.ByAltTextQuery.options=?, 388 | renderResult 389 | ) => 390 | Js.Promise.t(array(Dom.element)); 391 | 392 | // ByTitle 393 | let getByTitle: 394 | ( 395 | ~matcher: [ 396 | | `Str(string) 397 | | `RegExp(Js.Re.t) 398 | | `Func((string, Dom.element) => bool) 399 | ], 400 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 401 | renderResult 402 | ) => 403 | Dom.element; 404 | 405 | let getAllByTitle: 406 | ( 407 | ~matcher: [ 408 | | `Str(string) 409 | | `RegExp(Js.Re.t) 410 | | `Func((string, Dom.element) => bool) 411 | ], 412 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 413 | renderResult 414 | ) => 415 | array(Dom.element); 416 | 417 | let queryByTitle: 418 | ( 419 | ~matcher: [ 420 | | `Str(string) 421 | | `RegExp(Js.Re.t) 422 | | `Func((string, Dom.element) => bool) 423 | ], 424 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 425 | renderResult 426 | ) => 427 | Js.null(Dom.element); 428 | 429 | let queryAllByTitle: 430 | ( 431 | ~matcher: [ 432 | | `Str(string) 433 | | `RegExp(Js.Re.t) 434 | | `Func((string, Dom.element) => bool) 435 | ], 436 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 437 | renderResult 438 | ) => 439 | array(Dom.element); 440 | 441 | let findByTitle: 442 | ( 443 | ~matcher: [ 444 | | `Str(string) 445 | | `RegExp(Js.Re.t) 446 | | `Func((string, Dom.element) => bool) 447 | ], 448 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 449 | renderResult 450 | ) => 451 | Js.Promise.t(Dom.element); 452 | 453 | let findAllByTitle: 454 | ( 455 | ~matcher: [ 456 | | `Str(string) 457 | | `RegExp(Js.Re.t) 458 | | `Func((string, Dom.element) => bool) 459 | ], 460 | ~options: DomTestingLibrary.ByTitleQuery.options=?, 461 | renderResult 462 | ) => 463 | Js.Promise.t(array(Dom.element)); 464 | 465 | // ByDisplayValue 466 | let getByDisplayValue: 467 | ( 468 | ~matcher: [ 469 | | `Str(string) 470 | | `RegExp(Js.Re.t) 471 | | `Func((string, Dom.element) => bool) 472 | ], 473 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 474 | renderResult 475 | ) => 476 | Dom.element; 477 | 478 | let getAllByDisplayValue: 479 | ( 480 | ~matcher: [ 481 | | `Str(string) 482 | | `RegExp(Js.Re.t) 483 | | `Func((string, Dom.element) => bool) 484 | ], 485 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 486 | renderResult 487 | ) => 488 | array(Dom.element); 489 | 490 | let queryByDisplayValue: 491 | ( 492 | ~matcher: [ 493 | | `Str(string) 494 | | `RegExp(Js.Re.t) 495 | | `Func((string, Dom.element) => bool) 496 | ], 497 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 498 | renderResult 499 | ) => 500 | Js.null(Dom.element); 501 | 502 | let queryAllByDisplayValue: 503 | ( 504 | ~matcher: [ 505 | | `Str(string) 506 | | `RegExp(Js.Re.t) 507 | | `Func((string, Dom.element) => bool) 508 | ], 509 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 510 | renderResult 511 | ) => 512 | array(Dom.element); 513 | 514 | let findByDisplayValue: 515 | ( 516 | ~matcher: [ 517 | | `Str(string) 518 | | `RegExp(Js.Re.t) 519 | | `Func((string, Dom.element) => bool) 520 | ], 521 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 522 | renderResult 523 | ) => 524 | Js.Promise.t(Dom.element); 525 | 526 | let findAllByDisplayValue: 527 | ( 528 | ~matcher: [ 529 | | `Str(string) 530 | | `RegExp(Js.Re.t) 531 | | `Func((string, Dom.element) => bool) 532 | ], 533 | ~options: DomTestingLibrary.ByDisplayValueQuery.options=?, 534 | renderResult 535 | ) => 536 | Js.Promise.t(array(Dom.element)); 537 | 538 | // ByRole 539 | let getByRole: 540 | ( 541 | ~matcher: [ 542 | | `Str(string) 543 | | `RegExp(Js.Re.t) 544 | | `Func((string, Dom.element) => bool) 545 | ], 546 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 547 | renderResult 548 | ) => 549 | Dom.element; 550 | 551 | let getAllByRole: 552 | ( 553 | ~matcher: [ 554 | | `Str(string) 555 | | `RegExp(Js.Re.t) 556 | | `Func((string, Dom.element) => bool) 557 | ], 558 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 559 | renderResult 560 | ) => 561 | array(Dom.element); 562 | 563 | let queryByRole: 564 | ( 565 | ~matcher: [ 566 | | `Str(string) 567 | | `RegExp(Js.Re.t) 568 | | `Func((string, Dom.element) => bool) 569 | ], 570 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 571 | renderResult 572 | ) => 573 | Js.null(Dom.element); 574 | 575 | let queryAllByRole: 576 | ( 577 | ~matcher: [ 578 | | `Str(string) 579 | | `RegExp(Js.Re.t) 580 | | `Func((string, Dom.element) => bool) 581 | ], 582 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 583 | renderResult 584 | ) => 585 | array(Dom.element); 586 | 587 | let findByRole: 588 | ( 589 | ~matcher: [ 590 | | `Str(string) 591 | | `RegExp(Js.Re.t) 592 | | `Func((string, Dom.element) => bool) 593 | ], 594 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 595 | renderResult 596 | ) => 597 | Js.Promise.t(Dom.element); 598 | 599 | let findAllByRole: 600 | ( 601 | ~matcher: [ 602 | | `Str(string) 603 | | `RegExp(Js.Re.t) 604 | | `Func((string, Dom.element) => bool) 605 | ], 606 | ~options: DomTestingLibrary.ByRoleQuery.options=?, 607 | renderResult 608 | ) => 609 | Js.Promise.t(array(Dom.element)); 610 | 611 | // ByTestId 612 | let getByTestId: 613 | ( 614 | ~matcher: [ 615 | | `Str(string) 616 | | `RegExp(Js.Re.t) 617 | | `Func((string, Dom.element) => bool) 618 | ], 619 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 620 | renderResult 621 | ) => 622 | Dom.element; 623 | 624 | let getAllByTestId: 625 | ( 626 | ~matcher: [ 627 | | `Str(string) 628 | | `RegExp(Js.Re.t) 629 | | `Func((string, Dom.element) => bool) 630 | ], 631 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 632 | renderResult 633 | ) => 634 | array(Dom.element); 635 | 636 | let queryByTestId: 637 | ( 638 | ~matcher: [ 639 | | `Str(string) 640 | | `RegExp(Js.Re.t) 641 | | `Func((string, Dom.element) => bool) 642 | ], 643 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 644 | renderResult 645 | ) => 646 | Js.null(Dom.element); 647 | 648 | let queryAllByTestId: 649 | ( 650 | ~matcher: [ 651 | | `Str(string) 652 | | `RegExp(Js.Re.t) 653 | | `Func((string, Dom.element) => bool) 654 | ], 655 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 656 | renderResult 657 | ) => 658 | array(Dom.element); 659 | 660 | let findByTestId: 661 | ( 662 | ~matcher: [ 663 | | `Str(string) 664 | | `RegExp(Js.Re.t) 665 | | `Func((string, Dom.element) => bool) 666 | ], 667 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 668 | renderResult 669 | ) => 670 | Js.Promise.t(Dom.element); 671 | 672 | let findAllByTestId: 673 | ( 674 | ~matcher: [ 675 | | `Str(string) 676 | | `RegExp(Js.Re.t) 677 | | `Func((string, Dom.element) => bool) 678 | ], 679 | ~options: DomTestingLibrary.ByTestIdQuery.options=?, 680 | renderResult 681 | ) => 682 | Js.Promise.t(array(Dom.element)); 683 | 684 | [@bs.send.pipe: renderResult] 685 | external rerender: ReasonReact.reactElement => unit = "rerender"; 686 | 687 | let render: 688 | ( 689 | ~baseElement: Dom.element=?, 690 | ~container: Dom.element=?, 691 | ~hydrate: bool=?, 692 | ~wrapper: Dom.element=?, 693 | ~queries: queries=?, 694 | ReasonReact.reactElement 695 | ) => 696 | renderResult; 697 | 698 | let debug: 699 | (~el: Dom.element=?, ~maxLengthToPrint: int=?, unit, renderResult) => unit; 700 | -------------------------------------------------------------------------------- /src/__tests__/ReactTestingLibrary_test.re: -------------------------------------------------------------------------------- 1 | [@coverage exclude_file]; 2 | 3 | open Jest; 4 | 5 | afterAll(Bisect.Runtime.write_coverage_data); 6 | 7 | module Greeting = { 8 | [@react.component] 9 | let make = (~message) =>
{ReasonReact.string(message)}
; 10 | }; 11 | 12 | module Counter = { 13 | type action = 14 | | Inc 15 | | Dec; 16 | 17 | [@react.component] 18 | let make = () => { 19 | let (state, dispatch) = 20 | React.useReducer( 21 | (state, action) => 22 | switch (action) { 23 | | Inc => state + 1 24 | | Dec => state - 1 25 | }, 26 | 0, 27 | ); 28 | 29 |
30 | {ReasonReact.string("Count: " ++ string_of_int(state))} 31 | 34 | 37 |
; 38 | }; 39 | }; 40 | 41 | external unsafeAsElement: Dom.node => Dom.element = "%identity"; 42 | [@bs.get] external firstChild: Dom.element => Dom.node = "firstChild"; 43 | [@bs.get] external innerHTML: Dom.node => string = "innerHTML"; 44 | 45 | describe("ReactTestingLibrary", () => { 46 | open ReactTestingLibrary; 47 | open Expect; 48 | 49 | let element = 50 |
51 | {ReasonReact.cloneElement( 52 |

, 53 | ~props={"data-testid": "h1-heading"}, 54 | [|ReasonReact.string("Heading")|], 55 | )} 56 |

; 57 | 58 | test("render works", () => 59 | element |> render |> expect |> toMatchSnapshot 60 | ); 61 | 62 | // ByLabelText 63 | describe("ByLabelText", () => { 64 | let labelText = 65 |
66 | 67 | 68 |
; 69 | 70 | test("getByLabelText works", () => 71 | labelText 72 | |> render 73 | |> getByLabelText(~matcher=`Str("Username")) 74 | |> expect 75 | |> toMatchSnapshot 76 | ); 77 | 78 | test("getAllByLabelText works", () => 79 | labelText 80 | |> render 81 | |> getAllByLabelText(~matcher=`Str("Username")) 82 | |> expect 83 | |> toMatchSnapshot 84 | ); 85 | 86 | test("queryByLabelText works", () => 87 | labelText 88 | |> render 89 | |> queryByLabelText(~matcher=`Str("Username")) 90 | |> expect 91 | |> toMatchSnapshot 92 | ); 93 | 94 | test("queryByLabelText works (element not found)", () => 95 | labelText 96 | |> render 97 | |> queryByLabelText(~matcher=`Str("!@#$Username!@#$")) 98 | |> expect 99 | |> toMatchSnapshot 100 | ); 101 | 102 | test("queryAllByLabelText works", () => 103 | labelText 104 | |> render 105 | |> queryAllByLabelText(~matcher=`Str("Username")) 106 | |> expect 107 | |> toMatchSnapshot 108 | ); 109 | 110 | testPromise("findByLabelText works", () => 111 | labelText 112 | |> render 113 | |> findByLabelText(~matcher=`Str("Username")) 114 | |> Js.Promise.then_(result => 115 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 116 | ) 117 | ); 118 | 119 | testPromise("findAllByLabelText works", () => 120 | labelText 121 | |> render 122 | |> findAllByLabelText(~matcher=`Str("Username")) 123 | |> Js.Promise.then_(result => 124 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 125 | ) 126 | ); 127 | }); 128 | 129 | // ByPlaceholderText 130 | describe("ByPlaceholderText", () => { 131 | let placeholderText = 132 |
133 | 134 | 135 |
; 136 | 137 | test("getByPlaceholderText works", () => 138 | placeholderText 139 | |> render 140 | |> getByPlaceholderText(~matcher=`Str("Username")) 141 | |> expect 142 | |> toMatchSnapshot 143 | ); 144 | 145 | test("getAllByPlaceholderText works", () => 146 | placeholderText 147 | |> render 148 | |> getAllByPlaceholderText(~matcher=`Str("Username")) 149 | |> expect 150 | |> toMatchSnapshot 151 | ); 152 | 153 | test("queryByPlaceholderText works", () => 154 | placeholderText 155 | |> render 156 | |> queryByPlaceholderText(~matcher=`Str("Username")) 157 | |> expect 158 | |> toMatchSnapshot 159 | ); 160 | 161 | test("queryByPlaceholderText works (element not found)", () => 162 | placeholderText 163 | |> render 164 | |> queryByPlaceholderText(~matcher=`Str("!@#$Username!@#$")) 165 | |> expect 166 | |> toMatchSnapshot 167 | ); 168 | 169 | test("queryAllByPlaceholderText works", () => 170 | placeholderText 171 | |> render 172 | |> queryAllByPlaceholderText(~matcher=`Str("Username")) 173 | |> expect 174 | |> toMatchSnapshot 175 | ); 176 | 177 | testPromise("findByPlaceholderText works", () => 178 | placeholderText 179 | |> render 180 | |> findByPlaceholderText(~matcher=`Str("Username")) 181 | |> Js.Promise.then_(result => 182 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 183 | ) 184 | ); 185 | 186 | testPromise("findAllByPlaceholderText works", () => 187 | placeholderText 188 | |> render 189 | |> findAllByPlaceholderText(~matcher=`Str("Username")) 190 | |> Js.Promise.then_(result => 191 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 192 | ) 193 | ); 194 | }); 195 | 196 | // ByText 197 | describe("ByText", () => { 198 | let text = 199 |
{React.string({j|About ℹ️|j})}
; 200 | 201 | test("getByText works", () => 202 | text 203 | |> render 204 | |> getByText(~matcher=`Str({j|About ℹ️|j})) 205 | |> expect 206 | |> toMatchSnapshot 207 | ); 208 | 209 | test("getAllByText works", () => 210 | text 211 | |> render 212 | |> getAllByText(~matcher=`Str({j|About ℹ️|j})) 213 | |> expect 214 | |> toMatchSnapshot 215 | ); 216 | 217 | test("queryByText works", () => 218 | text 219 | |> render 220 | |> queryByText(~matcher=`Str({j|About ℹ️|j})) 221 | |> expect 222 | |> toMatchSnapshot 223 | ); 224 | 225 | test("queryByText works (element not found)", () => 226 | text 227 | |> render 228 | |> queryByText(~matcher=`Str({j|!@#About ℹ️!@#|j})) 229 | |> expect 230 | |> toMatchSnapshot 231 | ); 232 | 233 | test("queryAllByText works", () => 234 | text 235 | |> render 236 | |> queryAllByText(~matcher=`Str({j|About ℹ️|j})) 237 | |> expect 238 | |> toMatchSnapshot 239 | ); 240 | 241 | testPromise("findByText works", () => 242 | text 243 | |> render 244 | |> findByText(~matcher=`Str({j|About ℹ️|j})) 245 | |> Js.Promise.then_(result => 246 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 247 | ) 248 | ); 249 | 250 | testPromise("findAllByText works", () => 251 | text 252 | |> render 253 | |> findAllByText(~matcher=`Str({j|About ℹ️|j})) 254 | |> Js.Promise.then_(result => 255 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 256 | ) 257 | ); 258 | }); 259 | 260 | // ByAltText 261 | describe("ByAltText", () => { 262 | let altText = 263 |
264 | Incredibles 1 Poster 265 | Incredibles 2 Poster 266 |
; 267 | 268 | test("getByAltText works", () => 269 | altText 270 | |> render 271 | |> getByAltText(~matcher=`Str("Incredibles 2 Poster")) 272 | |> expect 273 | |> toMatchSnapshot 274 | ); 275 | 276 | test("getAllByAltText works", () => 277 | altText 278 | |> render 279 | |> getAllByAltText(~matcher=`Str("Incredibles 2 Poster")) 280 | |> expect 281 | |> toMatchSnapshot 282 | ); 283 | 284 | test("queryByAltText works", () => 285 | altText 286 | |> render 287 | |> queryByAltText(~matcher=`Str("Incredibles 2 Poster")) 288 | |> expect 289 | |> toMatchSnapshot 290 | ); 291 | 292 | test("queryByAltText works (element not found)", () => 293 | altText 294 | |> render 295 | |> queryByAltText(~matcher=`Str("!@#$Incredibles 2 Poster!@#$")) 296 | |> expect 297 | |> toMatchSnapshot 298 | ); 299 | 300 | test("queryAllByAltText works", () => 301 | altText 302 | |> render 303 | |> queryAllByAltText(~matcher=`Str("Incredibles 2 Poster")) 304 | |> expect 305 | |> toMatchSnapshot 306 | ); 307 | 308 | testPromise("findByAltText works", () => 309 | altText 310 | |> render 311 | |> findByAltText(~matcher=`Str("Incredibles 2 Poster")) 312 | |> Js.Promise.then_(result => 313 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 314 | ) 315 | ); 316 | 317 | testPromise("findAllByAltText works", () => 318 | altText 319 | |> render 320 | |> findAllByAltText(~matcher=`Str("Incredibles 2 Poster")) 321 | |> Js.Promise.then_(result => 322 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 323 | ) 324 | ); 325 | }); 326 | 327 | // ByTitle 328 | describe("ByTitle", () => { 329 | let title = 330 |
331 | 332 | 333 | {React.string("Close")} 334 | 335 | 336 |
; 337 | 338 | test("getByTitle works", () => 339 | title 340 | |> render 341 | |> getByTitle(~matcher=`Str("Delete")) 342 | |> expect 343 | |> toMatchSnapshot 344 | ); 345 | 346 | test("getAllByTitle works", () => 347 | title 348 | |> render 349 | |> getAllByTitle(~matcher=`Str("Delete")) 350 | |> expect 351 | |> toMatchSnapshot 352 | ); 353 | 354 | test("queryByTitle works", () => 355 | title 356 | |> render 357 | |> queryByTitle(~matcher=`Str("Delete")) 358 | |> expect 359 | |> toMatchSnapshot 360 | ); 361 | 362 | test("queryByTitle works (element not found)", () => 363 | title 364 | |> render 365 | |> queryByTitle(~matcher=`Str("!@#$Delete!@#$")) 366 | |> expect 367 | |> toMatchSnapshot 368 | ); 369 | 370 | test("queryAllByTitle works", () => 371 | title 372 | |> render 373 | |> queryAllByTitle(~matcher=`Str("Delete")) 374 | |> expect 375 | |> toMatchSnapshot 376 | ); 377 | 378 | testPromise("findByTitle works", () => 379 | title 380 | |> render 381 | |> findByTitle(~matcher=`Str("Delete")) 382 | |> Js.Promise.then_(result => 383 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 384 | ) 385 | ); 386 | 387 | testPromise("findAllByTitle works", () => 388 | title 389 | |> render 390 | |> findAllByTitle(~matcher=`Str("Delete")) 391 | |> Js.Promise.then_(result => 392 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 393 | ) 394 | ); 395 | }); 396 | 397 | // ByDisplayValue 398 | describe("ByDisplayValue", () => { 399 | let title = 400 |
401 | 402 |
; 403 | 404 | test("getByDisplayValue works", () => 405 | title 406 | |> render 407 | |> getByDisplayValue(~matcher=`Str("ReasonML")) 408 | |> expect 409 | |> toMatchSnapshot 410 | ); 411 | 412 | test("getAllByDisplayValue works", () => 413 | title 414 | |> render 415 | |> getAllByDisplayValue(~matcher=`Str("ReasonML")) 416 | |> expect 417 | |> toMatchSnapshot 418 | ); 419 | 420 | test("queryByDisplayValue works", () => 421 | title 422 | |> render 423 | |> queryByDisplayValue(~matcher=`Str("ReasonML")) 424 | |> expect 425 | |> toMatchSnapshot 426 | ); 427 | 428 | test("queryByDisplayValue works (element not found)", () => 429 | title 430 | |> render 431 | |> queryByDisplayValue(~matcher=`Str("!@#$ReasonML!@#$")) 432 | |> expect 433 | |> toMatchSnapshot 434 | ); 435 | 436 | test("queryAllByDisplayValue works", () => 437 | title 438 | |> render 439 | |> queryAllByDisplayValue(~matcher=`Str("ReasonML")) 440 | |> expect 441 | |> toMatchSnapshot 442 | ); 443 | 444 | testPromise("findByDisplayValue works", () => 445 | title 446 | |> render 447 | |> findByDisplayValue(~matcher=`Str("ReasonML")) 448 | |> Js.Promise.then_(result => 449 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 450 | ) 451 | ); 452 | 453 | testPromise("findAllByDisplayValue works", () => 454 | title 455 | |> render 456 | |> findAllByDisplayValue(~matcher=`Str("ReasonML")) 457 | |> Js.Promise.then_(result => 458 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 459 | ) 460 | ); 461 | }); 462 | 463 | // ByRole 464 | describe("ByRole", () => { 465 | let role = 466 |
467 | 468 | 469 |
; 470 | 471 | test("getByRole works", () => 472 | role 473 | |> render 474 | |> getByRole(~matcher=`Str("button")) 475 | |> expect 476 | |> toMatchSnapshot 477 | ); 478 | 479 | test("getAllByRole works", () => 480 | role 481 | |> render 482 | |> getAllByRole(~matcher=`Str("button")) 483 | |> expect 484 | |> toMatchSnapshot 485 | ); 486 | 487 | test("queryByRole works", () => 488 | role 489 | |> render 490 | |> queryByRole(~matcher=`Str("button")) 491 | |> expect 492 | |> toMatchSnapshot 493 | ); 494 | 495 | test("queryByRole works (element not found)", () => 496 | role 497 | |> render 498 | |> queryByRole(~matcher=`Str("!@#$button!@#$")) 499 | |> expect 500 | |> toMatchSnapshot 501 | ); 502 | 503 | test("queryAllByRole works", () => 504 | role 505 | |> render 506 | |> queryAllByRole(~matcher=`Str("button")) 507 | |> expect 508 | |> toMatchSnapshot 509 | ); 510 | 511 | testPromise("findByRole works", () => 512 | role 513 | |> render 514 | |> findByRole(~matcher=`Str("button")) 515 | |> Js.Promise.then_(result => 516 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 517 | ) 518 | ); 519 | 520 | testPromise("findAllByRole works", () => 521 | role 522 | |> render 523 | |> findAllByRole(~matcher=`Str("button")) 524 | |> Js.Promise.then_(result => 525 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 526 | ) 527 | ); 528 | }); 529 | 530 | // ByTestId 531 | describe("ByTestId", () => { 532 | test("getByTestId works", () => 533 | element 534 | |> render 535 | |> getByTestId(~matcher=`Str("h1-heading")) 536 | |> expect 537 | |> toMatchSnapshot 538 | ); 539 | 540 | test("getAllByTestId works", () => 541 | element 542 | |> render 543 | |> getAllByTestId(~matcher=`Str("h1-heading")) 544 | |> expect 545 | |> toMatchSnapshot 546 | ); 547 | 548 | test("queryByTestId works", () => 549 | element 550 | |> render 551 | |> queryByTestId(~matcher=`Str("h1-heading")) 552 | |> expect 553 | |> toMatchSnapshot 554 | ); 555 | 556 | test("queryByTestId works (element not found)", () => 557 | element 558 | |> render 559 | |> queryByTestId(~matcher=`Str("!@#$h1-heading!@#$")) 560 | |> expect 561 | |> toMatchSnapshot 562 | ); 563 | 564 | test("queryAllByTestId works", () => 565 | element 566 | |> render 567 | |> queryAllByTestId(~matcher=`Str("h1-heading")) 568 | |> expect 569 | |> toMatchSnapshot 570 | ); 571 | 572 | testPromise("findByTestId works", () => 573 | element 574 | |> render 575 | |> findByTestId(~matcher=`Str("h1-heading")) 576 | |> Js.Promise.then_(result => 577 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 578 | ) 579 | ); 580 | 581 | testPromise("findAllByTestId works", () => 582 | element 583 | |> render 584 | |> findAllByTestId(~matcher=`Str("h1-heading")) 585 | |> Js.Promise.then_(result => 586 | result |> expect |> toMatchSnapshot |> Js.Promise.resolve 587 | ) 588 | ); 589 | }); 590 | 591 | describe("debug", () => { 592 | beforeEach(() => { 593 | let _ = [%raw 594 | {|jest.spyOn(console, 'log').mockImplementation(() => {})|} 595 | ]; 596 | (); 597 | }); 598 | 599 | afterEach(() => { 600 | let _ = [%raw {|console.log.mockRestore()|}]; 601 | (); 602 | }); 603 | 604 | test("works", () => { 605 | let _ = element |> render |> debug(); 606 | 607 | let _ = [%raw {|expect(console.log).toHaveBeenCalledTimes(1)|}]; 608 | let _ = [%raw 609 | {| 610 | expect(console.log).toHaveBeenCalledWith( 611 | expect.stringContaining('Heading') 612 | ) 613 | |} 614 | ]; 615 | 616 | pass; 617 | }); 618 | 619 | test("works with element argument", () => { 620 | let result = element |> render; 621 | let el = result |> container |> firstChild |> unsafeAsElement; 622 | 623 | let _ = result |> debug(~el, ()); 624 | 625 | let _ = [%raw {|expect(console.log).toHaveBeenCalledTimes(1)|}]; 626 | let _ = [%raw 627 | {| 628 | expect(console.log).toHaveBeenCalledWith( 629 | expect.stringContaining('Heading') 630 | ) 631 | |} 632 | ]; 633 | 634 | pass; 635 | }); 636 | 637 | test("works with maxLengthToPrint argument", () => { 638 | let result = element |> render; 639 | let el = result |> container |> firstChild |> unsafeAsElement; 640 | 641 | let _ = result |> debug(~el, ~maxLengthToPrint=25, ()); 642 | 643 | let _ = [%raw {|expect(console.log).toHaveBeenCalledTimes(1)|}]; 644 | let _ = [%raw 645 | {| 646 | expect(console.log).toHaveBeenCalledWith( 647 | expect.stringContaining('sty...') 648 | ) 649 | |} 650 | ]; 651 | 652 | pass; 653 | }); 654 | }); 655 | 656 | test("rerender works", () => { 657 | let result = render(); 658 | let check = text => 659 | result 660 | |> container 661 | |> firstChild 662 | |> innerHTML 663 | |> expect 664 | |> toEqual(text); 665 | 666 | check("hi") |> ignore; 667 | 668 | result |> rerender(); 669 | 670 | check("hey"); 671 | }); 672 | 673 | test("asFragment works", () => 674 | element |> render |> asFragment() |> expect |> toMatchSnapshot 675 | ); 676 | 677 | test("act works", () => { 678 | let result = |> render; 679 | 680 | act(() => 681 | result |> getByText(~matcher=`Str("+")) |> FireEvent.click |> ignore 682 | ); 683 | 684 | result 685 | |> getByText(~matcher=`Str("Count: 1")) 686 | |> expect 687 | |> toMatchSnapshot; 688 | }); 689 | 690 | testPromise("Cleaunp, (element not found)", () => { 691 | let result = element |> render; 692 | 693 | cleanup(); 694 | 695 | Js.Promise.resolve( 696 | result 697 | |> queryByTestId(~matcher=`Str("h1-heading")) 698 | |> expect 699 | |> toMatchSnapshot, 700 | ); 701 | }); 702 | }); 703 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/ReactTestingLibrary_test.bs.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ReactTestingLibrary ByAltText findAllByAltText works 1`] = ` 4 | Array [ 5 | Incredibles 2 Poster, 9 | ] 10 | `; 11 | 12 | exports[`ReactTestingLibrary ByAltText findByAltText works 1`] = ` 13 | Incredibles 2 Poster 17 | `; 18 | 19 | exports[`ReactTestingLibrary ByAltText getAllByAltText works 1`] = ` 20 | Array [ 21 | Incredibles 2 Poster, 25 | ] 26 | `; 27 | 28 | exports[`ReactTestingLibrary ByAltText getByAltText works 1`] = ` 29 | Incredibles 2 Poster 33 | `; 34 | 35 | exports[`ReactTestingLibrary ByAltText queryAllByAltText works 1`] = ` 36 | Array [ 37 | Incredibles 2 Poster, 41 | ] 42 | `; 43 | 44 | exports[`ReactTestingLibrary ByAltText queryByAltText works (element not found) 1`] = `null`; 45 | 46 | exports[`ReactTestingLibrary ByAltText queryByAltText works 1`] = ` 47 | Incredibles 2 Poster 51 | `; 52 | 53 | exports[`ReactTestingLibrary ByDisplayValue findAllByDisplayValue works 1`] = ` 54 | Array [ 55 | , 60 | ] 61 | `; 62 | 63 | exports[`ReactTestingLibrary ByDisplayValue findByDisplayValue works 1`] = ` 64 | 69 | `; 70 | 71 | exports[`ReactTestingLibrary ByDisplayValue getAllByDisplayValue works 1`] = ` 72 | Array [ 73 | , 78 | ] 79 | `; 80 | 81 | exports[`ReactTestingLibrary ByDisplayValue getByDisplayValue works 1`] = ` 82 | 87 | `; 88 | 89 | exports[`ReactTestingLibrary ByDisplayValue queryAllByDisplayValue works 1`] = ` 90 | Array [ 91 | , 96 | ] 97 | `; 98 | 99 | exports[`ReactTestingLibrary ByDisplayValue queryByDisplayValue works (element not found) 1`] = `null`; 100 | 101 | exports[`ReactTestingLibrary ByDisplayValue queryByDisplayValue works 1`] = ` 102 | 107 | `; 108 | 109 | exports[`ReactTestingLibrary ByLabelText findAllByLabelText works 1`] = ` 110 | Array [ 111 | , 114 | ] 115 | `; 116 | 117 | exports[`ReactTestingLibrary ByLabelText findByLabelText works 1`] = ` 118 | 121 | `; 122 | 123 | exports[`ReactTestingLibrary ByLabelText getAllByLabelText works 1`] = ` 124 | Array [ 125 | , 128 | ] 129 | `; 130 | 131 | exports[`ReactTestingLibrary ByLabelText getByLabelText works 1`] = ` 132 | 135 | `; 136 | 137 | exports[`ReactTestingLibrary ByLabelText queryAllByLabelText works 1`] = ` 138 | Array [ 139 | , 142 | ] 143 | `; 144 | 145 | exports[`ReactTestingLibrary ByLabelText queryByLabelText works (element not found) 1`] = `null`; 146 | 147 | exports[`ReactTestingLibrary ByLabelText queryByLabelText works 1`] = ` 148 | 151 | `; 152 | 153 | exports[`ReactTestingLibrary ByPlaceholderText findAllByPlaceholderText works 1`] = ` 154 | Array [ 155 | , 158 | ] 159 | `; 160 | 161 | exports[`ReactTestingLibrary ByPlaceholderText findByPlaceholderText works 1`] = ` 162 | 165 | `; 166 | 167 | exports[`ReactTestingLibrary ByPlaceholderText getAllByPlaceholderText works 1`] = ` 168 | Array [ 169 | , 172 | ] 173 | `; 174 | 175 | exports[`ReactTestingLibrary ByPlaceholderText getByPlaceholderText works 1`] = ` 176 | 179 | `; 180 | 181 | exports[`ReactTestingLibrary ByPlaceholderText queryAllByPlaceholderText works 1`] = ` 182 | Array [ 183 | , 186 | ] 187 | `; 188 | 189 | exports[`ReactTestingLibrary ByPlaceholderText queryByPlaceholderText works (element not found) 1`] = `null`; 190 | 191 | exports[`ReactTestingLibrary ByPlaceholderText queryByPlaceholderText works 1`] = ` 192 | 195 | `; 196 | 197 | exports[`ReactTestingLibrary ByRole findAllByRole works 1`] = ` 198 | Array [ 199 | , 202 | ] 203 | `; 204 | 205 | exports[`ReactTestingLibrary ByRole findByRole works 1`] = ` 206 | 209 | `; 210 | 211 | exports[`ReactTestingLibrary ByRole getAllByRole works 1`] = ` 212 | Array [ 213 | , 216 | ] 217 | `; 218 | 219 | exports[`ReactTestingLibrary ByRole getByRole works 1`] = ` 220 | 223 | `; 224 | 225 | exports[`ReactTestingLibrary ByRole queryAllByRole works 1`] = ` 226 | Array [ 227 | , 230 | ] 231 | `; 232 | 233 | exports[`ReactTestingLibrary ByRole queryByRole works (element not found) 1`] = `null`; 234 | 235 | exports[`ReactTestingLibrary ByRole queryByRole works 1`] = ` 236 | 239 | `; 240 | 241 | exports[`ReactTestingLibrary ByTestId findAllByTestId works 1`] = ` 242 | Array [ 243 |

246 | Heading 247 |

, 248 | ] 249 | `; 250 | 251 | exports[`ReactTestingLibrary ByTestId findByTestId works 1`] = ` 252 |

255 | Heading 256 |

257 | `; 258 | 259 | exports[`ReactTestingLibrary ByTestId getAllByTestId works 1`] = ` 260 | Array [ 261 |

264 | Heading 265 |

, 266 | ] 267 | `; 268 | 269 | exports[`ReactTestingLibrary ByTestId getByTestId works 1`] = ` 270 |

273 | Heading 274 |

275 | `; 276 | 277 | exports[`ReactTestingLibrary ByTestId queryAllByTestId works 1`] = ` 278 | Array [ 279 |

282 | Heading 283 |

, 284 | ] 285 | `; 286 | 287 | exports[`ReactTestingLibrary ByTestId queryByTestId works (element not found) 1`] = `null`; 288 | 289 | exports[`ReactTestingLibrary ByTestId queryByTestId works 1`] = ` 290 |

293 | Heading 294 |

295 | `; 296 | 297 | exports[`ReactTestingLibrary ByText findAllByText works 1`] = ` 298 | Array [ 299 | 302 | About ℹ️ 303 | , 304 | ] 305 | `; 306 | 307 | exports[`ReactTestingLibrary ByText findByText works 1`] = ` 308 | 311 | About ℹ️ 312 | 313 | `; 314 | 315 | exports[`ReactTestingLibrary ByText getAllByText works 1`] = ` 316 | Array [ 317 | 320 | About ℹ️ 321 | , 322 | ] 323 | `; 324 | 325 | exports[`ReactTestingLibrary ByText getByText works 1`] = ` 326 | 329 | About ℹ️ 330 | 331 | `; 332 | 333 | exports[`ReactTestingLibrary ByText queryAllByText works 1`] = ` 334 | Array [ 335 | 338 | About ℹ️ 339 | , 340 | ] 341 | `; 342 | 343 | exports[`ReactTestingLibrary ByText queryByText works (element not found) 1`] = `null`; 344 | 345 | exports[`ReactTestingLibrary ByText queryByText works 1`] = ` 346 | 349 | About ℹ️ 350 | 351 | `; 352 | 353 | exports[`ReactTestingLibrary ByTitle findAllByTitle works 1`] = ` 354 | Array [ 355 | , 359 | ] 360 | `; 361 | 362 | exports[`ReactTestingLibrary ByTitle findByTitle works 1`] = ` 363 | 367 | `; 368 | 369 | exports[`ReactTestingLibrary ByTitle getAllByTitle works 1`] = ` 370 | Array [ 371 | , 375 | ] 376 | `; 377 | 378 | exports[`ReactTestingLibrary ByTitle getByTitle works 1`] = ` 379 | 383 | `; 384 | 385 | exports[`ReactTestingLibrary ByTitle queryAllByTitle works 1`] = ` 386 | Array [ 387 | , 391 | ] 392 | `; 393 | 394 | exports[`ReactTestingLibrary ByTitle queryByTitle works (element not found) 1`] = `null`; 395 | 396 | exports[`ReactTestingLibrary ByTitle queryByTitle works 1`] = ` 397 | 401 | `; 402 | 403 | exports[`ReactTestingLibrary Cleaunp, (element not found) 1`] = `null`; 404 | 405 | exports[`ReactTestingLibrary act works 1`] = ` 406 |
407 | Count: 1 408 | 411 | 414 |
415 | `; 416 | 417 | exports[`ReactTestingLibrary asFragment works 1`] = ` 418 | 419 |
422 |

425 | Heading 426 |

427 |
428 |
429 | `; 430 | 431 | exports[`ReactTestingLibrary render works 1`] = ` 432 | Object { 433 | "asFragment": [Function], 434 | "baseElement": 435 |
436 |
439 |

442 | Heading 443 |

444 |
445 |
446 | , 447 | "container":
448 |
451 |

454 | Heading 455 |

456 |
457 |
, 458 | "debug": [Function], 459 | "findAllByAltText": [Function], 460 | "findAllByDisplayValue": [Function], 461 | "findAllByLabelText": [Function], 462 | "findAllByPlaceholderText": [Function], 463 | "findAllByRole": [Function], 464 | "findAllByTestId": [Function], 465 | "findAllByText": [Function], 466 | "findAllByTitle": [Function], 467 | "findByAltText": [Function], 468 | "findByDisplayValue": [Function], 469 | "findByLabelText": [Function], 470 | "findByPlaceholderText": [Function], 471 | "findByRole": [Function], 472 | "findByTestId": [Function], 473 | "findByText": [Function], 474 | "findByTitle": [Function], 475 | "getAllByAltText": [Function], 476 | "getAllByDisplayValue": [Function], 477 | "getAllByLabelText": [Function], 478 | "getAllByPlaceholderText": [Function], 479 | "getAllByRole": [Function], 480 | "getAllByTestId": [Function], 481 | "getAllByText": [Function], 482 | "getAllByTitle": [Function], 483 | "getByAltText": [Function], 484 | "getByDisplayValue": [Function], 485 | "getByLabelText": [Function], 486 | "getByPlaceholderText": [Function], 487 | "getByRole": [Function], 488 | "getByTestId": [Function], 489 | "getByText": [Function], 490 | "getByTitle": [Function], 491 | "queryAllByAltText": [Function], 492 | "queryAllByDisplayValue": [Function], 493 | "queryAllByLabelText": [Function], 494 | "queryAllByPlaceholderText": [Function], 495 | "queryAllByRole": [Function], 496 | "queryAllByTestId": [Function], 497 | "queryAllByText": [Function], 498 | "queryAllByTitle": [Function], 499 | "queryByAltText": [Function], 500 | "queryByDisplayValue": [Function], 501 | "queryByLabelText": [Function], 502 | "queryByPlaceholderText": [Function], 503 | "queryByRole": [Function], 504 | "queryByTestId": [Function], 505 | "queryByText": [Function], 506 | "queryByTitle": [Function], 507 | "rerender": [Function], 508 | "unmount": [Function], 509 | } 510 | `; 511 | --------------------------------------------------------------------------------