Liking cljdoc? Tell your friends :D

web.primitives.testing.scan

Read every element carrying an el-id and nest the readings by el-id path.

Shared by the SDK (runs the scripts in the browser via Playwright) and the gallery (runs them directly), so both see exactly the same snapshot.

"first-name" -> {:first-name {:type :input :value "John" :label "First name"}} "person--bla--ble" -> {:person {:bla {:ble {:type :text :text "Ble"}}}}

Each leaf says what it is (:type). Controls carry their :value (and :label when the control has one); everything else carries its visible :text.

Read every element carrying an el-id and nest the readings by el-id path.

Shared by the SDK (runs the scripts in the browser via Playwright) and the
gallery (runs them directly), so both see exactly the same snapshot.

  "first-name"         -> {:first-name {:type :input :value "John" :label "First name"}}
  "person--bla--ble"   -> {:person {:bla {:ble {:type :text :text "Ble"}}}}

Each leaf says what it is (:type). Controls carry their :value (and :label
when the control has one); everything else carries its visible :text.
raw docstring

->pathclj/s

(->path id)

Split an el-id string into its nested path of keywords. "person--first-name" -> [:person :first-name]

Split an el-id string into its nested path of keywords.
"person--first-name" -> [:person :first-name]
raw docstring

collect-jsclj/s

JS function scope => [[id, {type, value}] ...] reading every element with an id or data-testid under the scope CSS selector (whole document when nil). Each id is read once, from the first element that carries it.

JS function `scope => [[id, {type, value}] ...]` reading every element with
an id or data-testid under the `scope` CSS selector (whole document when
nil). Each id is read once, from the first element that carries it.
raw docstring

default-ignore?clj/s

(default-ignore? id)

Ids that are gallery chrome, MUI-generated or icons rather than el-ids.

Ids that are gallery chrome, MUI-generated or icons rather than el-ids.
raw docstring

nestclj/s

(nest entries)
(nest entries ignore?)

Build the nested map from [id leaf] pairs, skipping ids for which ignore? is true. When one id is a prefix of another ("row" and "row--amount"), the shorter one is kept under self-key inside the deeper branch, so no element is lost.

Build the nested map from `[id leaf]` pairs, skipping ids for which
`ignore?` is true. When one id is a prefix of another ("row" and
"row--amount"), the shorter one is kept under `self-key` inside the
deeper branch, so no element is lost.
raw docstring

read-value-jsclj/s

JS function el => {type, value, label, text} that detects the primitive type of el from the rendered DOM and reads its current state.

JS function `el => {type, value, label, text}` that detects the primitive
type of `el` from the rendered DOM and reads its current state.
raw docstring

readingclj/s

(reading raw)

Turn a raw reading from read-value-js (a map with string keys) into a leaf: {:type kw ...} holding :value/:label for controls, :text otherwise. Missing or nil fields are left out.

Turn a raw reading from `read-value-js` (a map with string keys) into a
leaf: {:type kw ...} holding :value/:label for controls, :text otherwise.
Missing or nil fields are left out.
raw docstring

self-keyclj/s

Key under which an element's own reading is kept when other el-ids nest below it, e.g. "row" next to "row--amount" -> {:row {:el/self .. :amount ..}}.

Key under which an element's own reading is kept when other el-ids nest
below it, e.g. "row" next to "row--amount" -> {:row {:el/self .. :amount ..}}.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close