(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.
(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.
(base-element env)
Returns the base element used in the given rendering environment.
Returns the base element used in the given rendering environment.
(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.
(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
Query by the alternate text of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#byalttext
(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`.
(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
Query by the text shown in an input element. See https://testing-library.com/docs/dom-testing-library/api-queries#bydisplayvalue
(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
Query by the label text of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bylabeltext
(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
Query by the placeholder text of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#byplaceholdertext
(by-role text & options)
Query by the Aria role of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#byrole
Query by the Aria role of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#byrole
(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
Query by the test-id attribute of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bytestid
(by-text text & options)
Query by the text of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bytext
Query by the text of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bytext
(by-title text & options)
Query by the title of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bytitle
Query by the title of a node. See https://testing-library.com/docs/dom-testing-library/api-queries#bytitle
(container env)
Returns the container element used in the given rendering environment.
Returns the container element used in the given rendering environment.
(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]].
(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]].
(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.
(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".
(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".
(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.
(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".
(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".
(rendering item & args)
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-optionsNote 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.
(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.
(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.
(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.
(wait-for* f & options)
Functional version of the macro wait-for
.
Functional version of the macro [[wait-for]].
(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.
(wait-for-removal* f & options)
Functional version of the macro wait-for-removal
.
Functional version of the macro [[wait-for-removal]].
(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`.
(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`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close