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

Function computeAriaSelected

src/role-helpers.js:237–246  ·  view source on GitHub ↗

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

(element)

Source from the content-addressed store, hash-verified

235 * @returns {boolean | undefined} - false/true if (not)selected, undefined if not selectable
236 */
237function computeAriaSelected(element) {
238 // implicit value from html-aam mappings: https://www.w3.org/TR/html-aam-1.0/#html-attribute-state-and-property-mappings
239 // https://www.w3.org/TR/html-aam-1.0/#details-id-97
240 if (element.tagName === 'OPTION') {
241 return element.selected
242 }
243
244 // explicit value
245 return checkBooleanAttribute(element, 'aria-selected')
246}
247
248/**
249 * @param {Element} element -

Callers 1

queryAllByRoleFunction · 0.90

Calls 1

checkBooleanAttributeFunction · 0.85

Tested by

no test coverage detected