Skip to content

expect-puppeteer: trim out redundant whitespace in textContent when doing text matching #51

Closed
@rkoval

Description

@rkoval

When matching on textContent, a lot of the time, there will be extra whitespace/newlines surrounding the text you're matching based on how the HTML looks within the element you're matching. It could be nice to strip all of the redundant whitespace out when doing the comparison within this library as well such that consumers of it don't need to account for that whitespace in their comparison strings.

For example, a textContent of

'    white  

  space   '

could be stripped to just

'white space'

to allow matching by passing just 'white space' without needing wildcards in the comparison string. This could vastly improve test cases asserting that text exists. This could also perhaps be configurable too in case someone actually needed the textContent as-is in the HTML.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions