@testing-library/jest-dom
Advanced tools
Comparing version 5.9.0 to 5.10.0
@@ -19,4 +19,14 @@ "use strict"; | ||
function isSupportsValidityMethod(element) { | ||
return FORM_TAGS.includes((0, _utils.getTag)(element)); | ||
} | ||
function isElementInvalid(element) { | ||
return !element.checkValidity(); | ||
const isHaveAriaInvalid = isElementHavingAriaInvalid(element); | ||
if (isSupportsValidityMethod(element)) { | ||
return isHaveAriaInvalid || !element.checkValidity(); | ||
} else { | ||
return isHaveAriaInvalid; | ||
} | ||
} | ||
@@ -26,3 +36,3 @@ | ||
(0, _utils.checkHtmlElement)(element, toBeInvalid, this); | ||
const isInvalid = isElementHavingAriaInvalid(element) || isElementInvalid(element); | ||
const isInvalid = isElementInvalid(element); | ||
return { | ||
@@ -39,3 +49,3 @@ pass: isInvalid, | ||
(0, _utils.checkHtmlElement)(element, toBeValid, this); | ||
const isValid = !isElementHavingAriaInvalid(element) && FORM_TAGS.includes((0, _utils.getTag)(element)) && !isElementInvalid(element); | ||
const isValid = !isElementInvalid(element); | ||
return { | ||
@@ -42,0 +52,0 @@ pass: isValid, |
{ | ||
"name": "@testing-library/jest-dom", | ||
"version": "5.9.0", | ||
"version": "5.10.0", | ||
"description": "Custom jest matchers to test the state of the DOM", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
"@babel/runtime": "^7.9.2", | ||
"@types/testing-library__jest-dom": "^5.0.2", | ||
"@types/testing-library__jest-dom": "^5.9.1", | ||
"chalk": "^3.0.0", | ||
@@ -38,0 +38,0 @@ "css": "^2.2.4", |
@@ -277,6 +277,5 @@ <div align="center"> | ||
This allows you to check if a form element, or the entire `form`, is currently | ||
invalid. | ||
This allows you to check if an element, is currently invalid. | ||
An `input`, `select`, `textarea`, or `form` element is invalid if it has an | ||
An element is invalid if it has an | ||
[`aria-invalid` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) | ||
@@ -363,10 +362,9 @@ with no value or a value of `"true"`, or if the result of | ||
This allows you to check if the value of a form element, or the entire `form`, | ||
is currently valid. | ||
This allows you to check if the value of an element, is currently valid. | ||
An `input`, `select`, `textarea`, or `form` element is valid if it has no | ||
[`aria-invalid` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute) | ||
An element is valid if it has no | ||
[`aria-invalid` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-invalid_attribute)s | ||
or an attribute value of `"false"`. The result of | ||
[`checkValidity()`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation) | ||
must also be `true`. | ||
must also be `true` if it's a form element. | ||
@@ -1161,2 +1159,3 @@ #### Examples | ||
<td align="center"><a href="https://rubenmoya.dev"><img src="https://avatars3.githubusercontent.com/u/905225?v=4" width="100px;" alt=""/><br /><sub><b>Rubén Moya</b></sub></a><br /><a href="https://github.com/testing-library/jest-dom/commits?author=rubenmoya" title="Code">💻</a> <a href="https://github.com/testing-library/jest-dom/commits?author=rubenmoya" title="Tests">⚠️</a> <a href="https://github.com/testing-library/jest-dom/commits?author=rubenmoya" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://danielavalero.com/"><img src="https://avatars1.githubusercontent.com/u/1307954?v=4" width="100px;" alt=""/><br /><sub><b>Daniela Valero</b></sub></a><br /><a href="https://github.com/testing-library/jest-dom/commits?author=DanielaValero" title="Code">💻</a> <a href="https://github.com/testing-library/jest-dom/commits?author=DanielaValero" title="Tests">⚠️</a> <a href="https://github.com/testing-library/jest-dom/commits?author=DanielaValero" title="Documentation">📖</a></td> | ||
</tr> | ||
@@ -1163,0 +1162,0 @@ </table> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101143
1005
1214