Liking cljdoc? Tell your friends :D

reacl-c.test-util.dom-testing


all-ofcljs

(all-of)
(all-of q)
(all-of q1 & more)

Query for all elements that match all of the given queries.

Query for all elements that match all of the given queries.
sourceraw docstring

any-ofcljs

(any-of)
(any-of q)
(any-of q1 & more)

Query for all elements that match any of the given queries.

Query for all elements that match any of the given queries.
sourceraw docstring

anythingcljs

source

base-elementcljs

(base-element env)

Returns the base element used in the given rendering environment.

Returns the base element used in the given rendering environment.
sourceraw docstring

build-query-fncljs

(build-query-fn query-all make-multi-error make-missing-error)

Creates a function that returns custom query like by-label-text, via a function that implements the 'query-all' logic, which should return a sequence of all matching nodes, and two functions that return an error message for the cases of finding more than one, resp. nothing at all.

For example:

  (def by-my-property (build-query-fn (fn [env v1] node-seq...) (fn [env v1] "Error") (fn [env v1] "Error")))

  (find node (by-my-property "foo"))

See https://testing-library.com/docs/react-testing-library/setup#add-custom-queries for some additional notes.

Creates a function that returns custom query like [[by-label-text]],
  via a function that implements the 'query-all' logic, which should
  return a sequence of all matching nodes, and two functions that
  return an error message for the cases of finding more than one,
  resp. nothing at all.

  For example:

```
  (def by-my-property (build-query-fn (fn [env v1] node-seq...) (fn [env v1] "Error") (fn [env v1] "Error")))

  (find node (by-my-property "foo"))
```

  See https://testing-library.com/docs/react-testing-library/setup#add-custom-queries for some additional notes.
sourceraw docstring

by-alt-textcljs

(by-alt-text text & options)
Query by the alternate text of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#byalttext
sourceraw docstring

by-attributecljs

(by-attribute attribute text & options)

Query by the given attribute, matching nodes where the attribute value matches the given string, regex of predicate text.

Query by the given attribute, matching nodes where the attribute
value matches the given string, regex of predicate `text`.
sourceraw docstring

by-display-valuecljs

(by-display-value text & options)
Query by the text shown in an input element. See
https://testing-library.com/docs/dom-testing-library/api-queries#bydisplayvalue
sourceraw docstring

by-label-textcljs

(by-label-text text & options)
Query by the label text of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#bylabeltext
sourceraw docstring

by-placeholder-textcljs

(by-placeholder-text text & options)
Query by the placeholder text of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#byplaceholdertext
sourceraw docstring

by-rolecljs

(by-role text & options)
Query by the Aria role of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#byrole
sourceraw docstring

by-test-idcljs

(by-test-id value & options)
Query by the test-id attribute of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#bytestid
sourceraw docstring

by-textcljs

(by-text text & options)
Query by the text of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#bytext
sourceraw docstring

by-titlecljs

(by-title text & options)
Query by the title of a node. See
https://testing-library.com/docs/dom-testing-library/api-queries#bytitle
sourceraw docstring

containercljs

(container env)

Returns the container element used in the given rendering environment.

Returns the container element used in the given rendering environment.
sourceraw docstring

findcljs

(find env what & options)

Asynchronously returns the matching node. If none or more than one nodes match, this will repeat the search until a timeout expires and then throw an exception. Options are the same as for wait-for.

Asynchronously returns the matching node. If none or more than one nodes
match, this will repeat the search until a timeout expires and then
throw an exception. Options are the same as for [[wait-for]].
sourceraw docstring

find-allcljs

(find-all env what & options)

Asynchronously returns all matching node. If no nodes match, this will repeat the search until a timeout expires and then throw an exception. Options are the same as for wait-for.

Asynchronously returns all matching node. If no nodes match, this
will repeat the search until a timeout expires and then throw an
exception. Options are the same as for [[wait-for]].
sourceraw docstring

fire-eventcljs

(fire-event node event & [event-properties])

Fire an event on the given DOM node, where event can be a DOM Event object, or a keywork like :click for standard events. See https://github.com/testing-library/dom-testing-library/blob/master/src/event-map.js for a list.

Fire an event on the given DOM `node`, where `event` can be a DOM
Event object, or a keywork like `:click` for standard events. See
https://github.com/testing-library/dom-testing-library/blob/master/src/event-map.js
for a list.
sourceraw docstring

getcljs

(get env what)

Returns the matching node, and throws if none or more than one node matches.

For example (get env (by-text "Hello")) will find an element containing the text "Hello".

Returns the matching node, and throws if none or more than one node matches.

For example `(get env (by-text "Hello"))` will find an element containing the text "Hello".
sourceraw docstring

get-allcljs

(get-all env what)

Returns all matching nodes, but throws if no nodes match.

For example (get-all env (by-text "Hello")) will find all elements containing the text "Hello".

Returns all matching nodes, but throws if no nodes match.

For example `(get-all env (by-text "Hello"))` will find all elements containing the text "Hello".
sourceraw docstring

nothingcljs

source

pretty-domcljs

(pretty-dom node)

Returns a string showing a pretty HTML markup corresponding to the given DOM node as good as possible.

Returns a string showing a pretty HTML markup corresponding to the
given DOM node as good as possible.
sourceraw docstring

querycljs

(query env what)

Returns matching node or nil, but throws if more than one node matches.

For example (query env (by-text "Hello")) will find an element containing the text "Hello".

Returns matching node or nil, but throws if more than one node matches.

For example `(query env (by-text "Hello"))` will find an element containing the text "Hello".
sourceraw docstring

query-allcljs

(query-all env what)

Returns all matching nodes.

For example (query-all env (by-text "Hello")) will find all elements containing the text "Hello".

Returns all matching nodes.

For example `(query-all env (by-text "Hello"))` will find all elements containing the text "Hello".
sourceraw docstring

renderingcljs

(rendering item & args)

Calls f with a rendering environment that 'runs' the given item. Options can be

Note that if f is asynchronous (returns a promise), then rendering will continue until the promise is resolved or rejected.

Calls `f` with a rendering environment that 'runs' the given item.
Options can be

- `:state` for the initial state of the item (defaulting to `nil`),
- `:visible?` specifying if the rendered dom should be made visible (the default looks at the `hidden` property of `js/document`),
- `:configuration` for configuration corresponing to https://testing-library.com/docs/dom-testing-library/api-configuration
- `:container`, `:baseElement`, `:hydrate` and `:wrapper` for rendering options corresponing to https://testing-library.com/docs/react-testing-library/api#render-options

Note that if `f` is asynchronous (returns a promise), then rendering will continue until the promise is resolved or rejected.
 
sourceraw docstring

unmount!cljs

(unmount! env)

Stops rendering in the given rendering environment. You usually don't have to call this.

Stops rendering in the given rendering environment. You usually don't have to call this.
sourceraw docstring

update!cljs

(update! env item state)

Change the item and state rendered in the given rendering environment.

Change the item and state rendered in the given rendering environment.
sourceraw docstring

wait-forcljmacro

(wait-for expr & options)

Returns a promise that evaluates expr repeatedly until it does not throw or a timeout elapses. Options can be:

  • :timeout the maximum number of milliseconds to wait,
  • :interval the number of milliseconds to wait between to evaluationg of expr.

For more options see https://testing-library.com/docs/dom-testing-library/api-async#waitfor.

Returns a promise that evaluates `expr` repeatedly until it does not throw or a timeout elapses.
Options can be:

- `:timeout` the maximum number of milliseconds to wait,
- `:interval` the number of milliseconds to wait between to evaluationg of `expr`.

For more options see https://testing-library.com/docs/dom-testing-library/api-async#waitfor.
sourceraw docstring

wait-for*cljs

(wait-for* f & options)

Functional version of the macro wait-for.

Functional version of the macro [[wait-for]].
sourceraw docstring

wait-for-removalcljmacro

(wait-for-removal expr & options)

Returns a promise that evaluates expr repeatedly until it throws or a timeout elapses. Options can be:

  • :timeout the maximum number of milliseconds to wait,
  • :interval the number of milliseconds to wait between to evaluationg of expr.

For more options see https://testing-library.com/docs/dom-testing-library/api-async#waitfor.

Returns a promise that evaluates `expr` repeatedly until it throws or a timeout elapses.
Options can be:

- `:timeout` the maximum number of milliseconds to wait,
- `:interval` the number of milliseconds to wait between to evaluationg of `expr`.

For more options see https://testing-library.com/docs/dom-testing-library/api-async#waitfor.
sourceraw docstring

wait-for-removal*cljs

(wait-for-removal* f & options)

Functional version of the macro wait-for-removal.

Functional version of the macro [[wait-for-removal]].
sourceraw docstring

withincljs

(within base-q child-q)

Query for elements matching child-q within the elements matching base-q.

Query for elements matching `child-q` within the elements matching `base-q`.
sourceraw docstring

within-nodecljs

(within-node base node)

Specifies node as different root node in element queries. base should be either a rendering environemnt, or the result of a previous call to within-node.

Specifies `node` as different root node in element queries. `base`
should be either a rendering environemnt, or the result of a
previous call to `within-node`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close