-
Notifications
You must be signed in to change notification settings - Fork 412
Open
Description
I believe there may be a bug in isElementOrAncestorDisabled
:
https://github.com/testing-library/jest-dom/blob/918b6fbcde10d4409ee8f05c6e4eecbe96a72b7a/src/to-be-disabled.js#L64C10-L64C37
and the function should be written like this instead:
function isElementOrAncestorDisabled(element) {
return (
canElementBeDisabled(element) &&
(isElementDisabled(element) || (!element.hasAttribute('disabled') && isAncestorDisabled(element)))
)
}
From: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled
If this attribute is not specified, the control inherits its setting from the containing element
Before checking the parent, the function should be checking that the attribute is not specified on the element.
Metadata
Metadata
Assignees
Labels
No labels