@testing-library/dom
Advanced tools
Comparing version 9.0.1 to 9.1.0
@@ -19,2 +19,3 @@ "use strict"; | ||
selected, | ||
busy, | ||
checked, | ||
@@ -34,6 +35,13 @@ pressed, | ||
} | ||
if (checked !== undefined) { | ||
if (busy !== undefined) { | ||
var _allRoles$get2; | ||
// guard against unknown roles | ||
if (((_allRoles$get2 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get2.props['aria-checked']) === undefined) { | ||
if (((_allRoles$get2 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get2.props['aria-busy']) === undefined) { | ||
throw new Error(`"aria-busy" is not supported on role "${role}".`); | ||
} | ||
} | ||
if (checked !== undefined) { | ||
var _allRoles$get3; | ||
// guard against unknown roles | ||
if (((_allRoles$get3 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get3.props['aria-checked']) === undefined) { | ||
throw new Error(`"aria-checked" is not supported on role "${role}".`); | ||
@@ -43,5 +51,5 @@ } | ||
if (pressed !== undefined) { | ||
var _allRoles$get3; | ||
var _allRoles$get4; | ||
// guard against unknown roles | ||
if (((_allRoles$get3 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get3.props['aria-pressed']) === undefined) { | ||
if (((_allRoles$get4 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get4.props['aria-pressed']) === undefined) { | ||
throw new Error(`"aria-pressed" is not supported on role "${role}".`); | ||
@@ -51,3 +59,3 @@ } | ||
if (current !== undefined) { | ||
var _allRoles$get4; | ||
var _allRoles$get5; | ||
/* istanbul ignore next */ | ||
@@ -57,3 +65,3 @@ // guard against unknown roles | ||
// Leaving this for symetry and forward compatibility | ||
if (((_allRoles$get4 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get4.props['aria-current']) === undefined) { | ||
if (((_allRoles$get5 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get5.props['aria-current']) === undefined) { | ||
throw new Error(`"aria-current" is not supported on role "${role}".`); | ||
@@ -69,5 +77,5 @@ } | ||
if (expanded !== undefined) { | ||
var _allRoles$get5; | ||
var _allRoles$get6; | ||
// guard against unknown roles | ||
if (((_allRoles$get5 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get5.props['aria-expanded']) === undefined) { | ||
if (((_allRoles$get6 = _ariaQuery.roles.get(role)) == null ? void 0 : _allRoles$get6.props['aria-expanded']) === undefined) { | ||
throw new Error(`"aria-expanded" is not supported on role "${role}".`); | ||
@@ -104,2 +112,5 @@ } | ||
} | ||
if (busy !== undefined) { | ||
return busy === (0, _roleHelpers.computeAriaBusy)(element); | ||
} | ||
if (checked !== undefined) { | ||
@@ -106,0 +117,0 @@ return checked === (0, _roleHelpers.computeAriaChecked)(element); |
@@ -6,2 +6,3 @@ "use strict"; | ||
}); | ||
exports.computeAriaBusy = computeAriaBusy; | ||
exports.computeAriaChecked = computeAriaChecked; | ||
@@ -230,2 +231,11 @@ exports.computeAriaCurrent = computeAriaCurrent; | ||
* @param {Element} element - | ||
* @returns {boolean} - | ||
*/ | ||
function computeAriaBusy(element) { | ||
// https://www.w3.org/TR/wai-aria-1.1/#aria-busy | ||
return element.getAttribute('aria-busy') === 'true'; | ||
} | ||
/** | ||
* @param {Element} element - | ||
* @returns {boolean | undefined} - false/true if (not)checked, undefined if not checked-able | ||
@@ -232,0 +242,0 @@ */ |
{ | ||
"name": "@testing-library/dom", | ||
"version": "9.0.1", | ||
"version": "9.1.0", | ||
"description": "Simple and complete DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -85,2 +85,7 @@ import {ByRoleMatcher, Matcher, MatcherOptions} from './matches' | ||
* If true only includes elements in the query set that are marked as | ||
* busy in the accessibility tree, i.e., `aria-busy="true"` | ||
*/ | ||
busy?: boolean | ||
/** | ||
* If true only includes elements in the query set that are marked as | ||
* checked in the accessibility tree, i.e., `aria-checked="true"` | ||
@@ -87,0 +92,0 @@ */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2927990
25131