Closed dwineknott closed 4 years ago
Hello @dwineknott,
You'll have to import it directly from @testing-library/dom
import {getDefaultNormalizer} from '@testing-library/dom'
I hope that helps!
Hi @kentcdodds . Thank you!
This indeed resolved my initial issue, but I am now getting the following in the console when running my script. In turn the new string is not being returned from here. Any guidance you could provide would be much appreciated:
cy.findAllByText(RegExp(writer.full_name, "i"),
{normalizer: str => getDefaultNormalizer ({trim: true})(str).replace(/^\s+|\s+$|\s+(?=\s)/g,"")}
)
Error from console:
cypress-testing-library
version: 6.0.0node
version: 12.16.3npm
(oryarn
) version: 6.14.4Relevant code or config
What you did: Attempting to call
getDefaultNormalizer
from within the above script portion.What happened:
Getting from my IDE:
Cannot find name 'getDefaultNormalizer'.
Reproduction repository: N/A
Problem description: Is this Normalizer call available via the cypress-testing-library? I don't see any documentation regarding this feature specific to Cypress. I have read https://testing-library.com/docs/dom-testing-library/api-queries#normalization . I'm hoping its a simple human error issue with the syntax I am using and this isn't a bug?
Suggested solution: Extend access to this call within Cypress.