Hey again! Would like some input if this is consid...
# best-practices
p
Hey again! Would like some input if this is considered best practice or not: Some of the elements on our page will sometimes contain a zero-width space for line breaking purposes. When we're looking for certain elements by text, one of our devs put this in:
Copy code
const normalize = (text) => text.replace(/\u200B/g, '')
const matchesSearch = (search) => (_index, label) =>
    normalize(label.textContent).includes(search)
which is used like so:
Copy code
cy.get('label')
    .then(($labels) => $labels.filter(matchesSearch('text_to_find_here')))
    .find('input')
Would it be better to use
cy.contains('label', 'text_to_find_here')
, or what would be the best approach to situations like this? Thanks!