MCPcopy
hub / github.com/testing-library/dom-testing-library / computeAriaChecked

Function computeAriaChecked

src/role-helpers.js:261–274  ·  view source on GitHub ↗

* @param {Element} element - * @returns {boolean | undefined} - false/true if (not)checked, undefined if not checked-able

(element)

Source from the content-addressed store, hash-verified

259 * @returns {boolean | undefined} - false/true if (not)checked, undefined if not checked-able
260 */
261function computeAriaChecked(element) {
262 // implicit value from html-aam mappings: https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings
263 // https://www.w3.org/TR/html-aam-1.0/#details-id-56
264 // https://www.w3.org/TR/html-aam-1.0/#details-id-67
265 if ('indeterminate' in element && element.indeterminate) {
266 return undefined
267 }
268 if ('checked' in element) {
269 return element.checked
270 }
271
272 // explicit value
273 return checkBooleanAttribute(element, 'aria-checked')
274}
275
276/**
277 * @param {Element} element -

Callers 1

queryAllByRoleFunction · 0.90

Calls 1

checkBooleanAttributeFunction · 0.85

Tested by

no test coverage detected