Element ids for the Button gallery page, shared by the view and the UI tests. Values are plain :el-id data (keywords / vectors); components and the SDK resolve them, so neither side builds id strings.
View: [RawButton {:el-id disabled} "Disabled"] [RawButton {:el-id (variant :contained)} "Contained"] Test: (button/click! (variant :contained)) (button/enabled? disabled)
Element ids for the Button gallery page, shared by the view and the UI
tests. Values are plain :el-id data (keywords / vectors); components and
the SDK resolve them, so neither side builds id strings.
View: [RawButton {:el-id disabled} "Disabled"]
[RawButton {:el-id (variant :contained)} "Contained"]
Test: (button/click! (variant :contained))
(button/enabled? disabled)RawAccordion / EddAccordion. el-id lands as data-testid on the accordion root. The expand toggle is the icon button inside the summary.
RawAccordion / EddAccordion. el-id lands as data-testid on the accordion root. The expand toggle is the icon button inside the summary.
RawAutocomplete. el-id lands as id on the combobox <input>.
RawAutocomplete. el-id lands as id on the combobox <input>.
RawButton, RawFab, RawIconButton, RawChoiceButton. el-id lands as data-testid on the <button>.
RawButton, RawFab, RawIconButton, RawChoiceButton. el-id lands as data-testid on the <button>.
RawCheckbox and RawSwitch. el-id lands as id on the native <input type=checkbox>, so checked state is read from the input itself.
RawCheckbox and RawSwitch. el-id lands as id on the native <input type=checkbox>, so checked state is read from the input itself.
Collect browser errors while a test runs, e.g. to fail a smoke test when a page throws or logs an error.
(let [errors (console/watch-errors!)] ... drive the UI ... (is (empty? (console/page-errors errors))))
Collect browser errors while a test runs, e.g. to fail a smoke test when
a page throws or logs an error.
(let [errors (console/watch-errors!)]
... drive the UI ...
(is (empty? (console/page-errors errors))))EddDatePicker / RawDatePicker.
MUI v9 renders a sectioned field: el-id lands on a hidden input and the visible value lives in Day / Month / Year spinbutton sections. These functions hide that so tests only deal with "dd.MM.yyyy" strings.
EddDatePicker / RawDatePicker. MUI v9 renders a sectioned field: el-id lands on a hidden input and the visible value lives in Day / Month / Year spinbutton sections. These functions hide that so tests only deal with "dd.MM.yyyy" strings.
RawDialog. MUI renders the dialog in a portal; el-id lands as data-testid on the dialog root, so it is found wherever it is mounted.
RawDialog. MUI renders the dialog in a portal; el-id lands as data-testid on the dialog root, so it is found wherever it is mounted.
Read-only queries for display components: typography, badge, chip, avatar, alert, list, table, tree view, card, backdrop, progress, skeleton.
Read-only queries for display components: typography, badge, chip, avatar, alert, list, table, tree view, card, backdrop, progress, skeleton.
RawDrawer / RawSwipeableDrawer. el-id lands as data-testid on the drawer root, which is portalled and only present while open.
RawDrawer / RawSwipeableDrawer. el-id lands as data-testid on the drawer root, which is portalled and only present while open.
RawMenu / RawMenuItem. Items carry their own el-id.
RawMenu / RawMenuItem. Items carry their own el-id.
RawRadioGroup. el-id lands as data-testid on the radiogroup.
RawRadioGroup. el-id lands as data-testid on the radiogroup.
RawSelect and RawFormSelect. RawSelect: el-id is the combobox itself. RawFormSelect: the combobox is el-id + "-select".
RawSelect and RawFormSelect. RawSelect: el-id is the combobox itself. RawFormSelect: the combobox is el-id + "-select".
RawSlider. el-id lands on the slider root <span>; the value lives on the inner <input type=range>, which is driven with the keyboard.
RawSlider. el-id lands on the slider root <span>; the value lives on the inner <input type=range>, which is driven with the keyboard.
RawSnackbar. el-id lands as data-testid on the snackbar root, which only exists while it is open.
RawSnackbar. el-id lands as data-testid on the snackbar root, which only exists while it is open.
RawSwitch. Behaves like a checkbox (el-id lands on the native input,
role=switch). For two-value switches on? means the right value.
RawSwitch. Behaves like a checkbox (el-id lands on the native input, role=switch). For two-value switches `on?` means the right value.
RawTabs. el-id lands as data-testid on the tabs root.
RawTabs. el-id lands as data-testid on the tabs root.
EddTextEditor / RawTextEditor. The editor uses el-id as its id and derives the editable area and the edit / save / discard buttons from it.
EddTextEditor / RawTextEditor. The editor uses el-id as its id and derives the editable area and the edit / save / discard buttons from it.
RawTextField, RawNumberField, RawPercentField. el-id lands as id on the native <input>.
RawTextField, RawNumberField, RawPercentField. el-id lands as id on the native <input>.
RawToggleButtonGroup / RawToggleButton. el-id lands as data-testid on the group; buttons are found by their value.
RawToggleButtonGroup / RawToggleButton. el-id lands as data-testid on the group; buttons are found by their value.
RawTooltip. el-id lands as data-testid on the wrapping Grid; the tooltip popup is portalled with role=tooltip.
RawTooltip. el-id lands as data-testid on the wrapping Grid; the tooltip popup is portalled with role=tooltip.
Read the current state of any primitive by el-id, and scan a whole page into a nested map keyed by el-id segments.
reading-of detects the primitive type from the rendered DOM and returns a
reading map:
text / number / percent field -> {:type :input :value ".." :label ".."}
checkbox -> {:type :checkbox :value true :label ".."}
switch -> {:type :switch :value true :label ".."}
select -> {:type :select :value "selected label"}
radio group -> {:type :radio :value "selected value"}
slider -> {:type :slider :value 30.0}
autocomplete -> {:type :autocomplete :value ".." or ["chip" ..]}
anything else -> {:type :text :text "visible text"}
scan returns the same reading maps as its leaves. The detection and
nesting logic lives in web.primitives.testing.scan, shared with the
gallery's in-browser snapshot button.
Read the current state of any primitive by el-id, and scan a whole page
into a nested map keyed by el-id segments.
`reading-of` detects the primitive type from the rendered DOM and returns a
reading map:
text / number / percent field -> {:type :input :value ".." :label ".."}
checkbox -> {:type :checkbox :value true :label ".."}
switch -> {:type :switch :value true :label ".."}
select -> {:type :select :value "selected label"}
radio group -> {:type :radio :value "selected value"}
slider -> {:type :slider :value 30.0}
autocomplete -> {:type :autocomplete :value ".." or ["chip" ..]}
anything else -> {:type :text :text "visible text"}
`scan` returns the same reading maps as its leaves. The detection and
nesting logic lives in web.primitives.testing.scan, shared with the
gallery's in-browser snapshot button.Resolves an :el-id value into the id string rendered into the DOM.
Callers never build strings themselves. Components and the SDK both call
el-id, so a view and a test using the same value always agree:
:first-name -> "first-name" :app.person/first-name -> "app.person/first-name" [:person "Bla" "ble"] -> "person--bla--ble" [some-element-fn "Bla"] -> whatever (some-element-fn "Bla") resolves to "already-built" -> "already-built"
Suffixes are joined with "--" so scanned ids can be split back into a nested path.
Resolves an :el-id value into the id string rendered into the DOM. Callers never build strings themselves. Components and the SDK both call `el-id`, so a view and a test using the same value always agree: :first-name -> "first-name" :app.person/first-name -> "app.person/first-name" [:person "Bla" "ble"] -> "person--bla--ble" [some-element-fn "Bla"] -> whatever (some-element-fn "Bla") resolves to "already-built" -> "already-built" Suffixes are joined with "--" so scanned ids can be split back into a nested path.
El-id data for gallery demos. Returns plain :el-id values (vectors), so a view passes them straight to a primitive's :el-id and a test passes the same value to the SDK; neither builds an id string.
(el :autocomplete :basic) -> [:autocomplete :basic] ; "autocomplete--basic" (el :slider :basic :readout) -> [:slider :basic :readout] ; "slider--basic--readout" (testid :slider :basic :readout) -> "slider--basic--readout" ; for raw :data-testid
El-id data for gallery demos. Returns plain :el-id values (vectors), so a view passes them straight to a primitive's :el-id and a test passes the same value to the SDK; neither builds an id string. (el :autocomplete :basic) -> [:autocomplete :basic] ; "autocomplete--basic" (el :slider :basic :readout) -> [:slider :basic :readout] ; "slider--basic--readout" (testid :slider :basic :readout) -> "slider--basic--readout" ; for raw :data-testid
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.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |