You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
toHaveDisplayValue produces the wrong result when using the standards compliant label attribute on HTMLOptionElement to supply the option text contents. Using inner text content on the element is actually the fallback for when the label attribute is not provided, but the toHaveDisplayValue matcher currently only considers .textContent.
The text was updated successfully, but these errors were encountered:
rjgotten
changed the title
toHaveDisplayValue does not correctly report displayed value for select options
toHaveDisplayValue does not report displayed value for option elements using label attribute
Aug 4, 2023
rjgotten
changed the title
toHaveDisplayValue does not report displayed value for option elements using label attribute
toHaveDisplayValue does not use consider label attribute on option elements
Aug 4, 2023
@testing-library/jest-dom
version: 5.17Relevant code or config:
Problem description:
toHaveDisplayValue
produces the wrong result when using the standards compliantlabel
attribute onHTMLOptionElement
to supply the option text contents. Using inner text content on the element is actually the fallback for when thelabel
attribute is not provided, but thetoHaveDisplayValue
matcher currently only considers.textContent
.jest-dom/src/to-have-display-value.js
Lines 51 to 57 in d717c66
Suggested solution:
Consider also the label attribute. E.g.
The text was updated successfully, but these errors were encountered: