@testing-library/jest-dom
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -13,3 +13,3 @@ "use strict"; | ||
const FORM_TAGS = ['input', 'select', 'textarea']; | ||
const FORM_TAGS = ['form', 'input', 'select', 'textarea']; | ||
@@ -16,0 +16,0 @@ function isElementHavingAriaInvalid(element) { |
{ | ||
"name": "@testing-library/jest-dom", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Custom jest matchers to test the state of the DOM", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -263,9 +263,10 @@ <div align="center"> | ||
This allows you to check if an form element is currently invalid. | ||
This allows you to check if a form element, or the entire `form`, is currently | ||
invalid. | ||
An element is invalid if it is having an | ||
An `input`, `select`, `textarea`, or `form` 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) | ||
or if the result of | ||
with no value or a value of `"true"`, or if the result of | ||
[`checkValidity()`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation) | ||
are false. | ||
is `false`. | ||
@@ -279,2 +280,10 @@ #### Examples | ||
<input data-testid="aria-invalid-false" aria-invalid="false" /> | ||
<form data-testid="valid-form"> | ||
<input /> | ||
</form> | ||
<form data-testid="invalid-form"> | ||
<input required /> | ||
</form> | ||
``` | ||
@@ -289,2 +298,5 @@ | ||
expect(queryByTestId('aria-invalid-false')).not.toBeInvalid() | ||
expect(queryByTestId('valid-form')).not.toBeInvalid() | ||
expect(queryByTestId('invalid-form')).toBeInvalid() | ||
``` | ||
@@ -299,2 +311,5 @@ | ||
expect(getByTestId(container, 'aria-invalid-false')).not.toBeInvalid() | ||
expect(getByTestId(container, 'valid-form')).not.toBeInvalid() | ||
expect(getByTestId(container, 'invalid-form')).toBeInvalid() | ||
``` | ||
@@ -379,8 +394,10 @@ | ||
This allows you to check if the value of a form element is currently valid. | ||
This allows you to check if the value of a form element, or the entire `form`, | ||
is currently valid. | ||
An element is valid if it is not having an | ||
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) | ||
or having `false` as a value and returning `true` when calling | ||
[`checkValidity()`](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation). | ||
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`. | ||
@@ -394,2 +411,10 @@ #### Examples | ||
<input data-testid="aria-invalid-false" aria-invalid="false" /> | ||
<form data-testid="valid-form"> | ||
<input /> | ||
</form> | ||
<form data-testid="invalid-form"> | ||
<input required /> | ||
</form> | ||
``` | ||
@@ -404,2 +429,5 @@ | ||
expect(queryByTestId('aria-invalid-false')).toBeValid() | ||
expect(queryByTestId('valid-form')).toBeValid() | ||
expect(queryByTestId('invalid-form')).not.toBeValid() | ||
``` | ||
@@ -414,2 +442,5 @@ | ||
expect(getByTestId(container, 'aria-invalid-false')).toBeValid() | ||
expect(getByTestId(container, 'valid-form')).toBeValid() | ||
expect(getByTestId(container, 'invalid-form')).not.toBeValid() | ||
``` | ||
@@ -416,0 +447,0 @@ |
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
80846
1131