Skip to content

This whitespace replace regex is not replacing   encoded whitespaces. #1592

@ChristianGreinke

Description

@ChristianGreinke

This whitespace replace regex is not replacing   encoded whitespaces.

https://github.com/simplabs/qunit-dom/blob/ec5c614f1ea589419eea1591f9b62d32760dc5a1/lib/helpers/collapse-whitespace.ts#L4

You could maybe replace with
.replace(/[ \u00a0]+/g, ' ')

It creates for example issues with assert.dom().hasText() where one uses test text to compare with dom element textContent and all multiple continuous white spaces from the test text are collapsed to one single white space.

For example with html

a   b


assert.dom('p').hasText('a b') would fail
and it is not possible to create a hasText parameter which would succeed the assertion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions