Skip to content

Commit

Permalink
feat: add normalized target for HTML entities
Browse files Browse the repository at this point in the history
  • Loading branch information
pengooseDev committed Dec 10, 2024
1 parent be27666 commit 2c903ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function cacheNormalizedWhitespaces() {
export function normalizeWhiteSpace(text: string): string {
let result = normalizedWhitespaceCache?.get(text);
if (result === undefined) {
result = text.replace(/\u200b/g, '').trim().replace(/\s+/g, ' ');
result = text.replace(/\u200b/g, '').replace(/ /g, ' ').trim().replace(/\s+/g, ' ');
normalizedWhitespaceCache?.set(text, result);
}
return result;
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/matchers/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export function toHaveValue(
options?: { timeout?: number },
) {
return toMatchText.call(this, 'toHaveValue', locator, 'Locator', async (isNot, timeout) => {
const expectedText = serializeExpectedTextValues([expected]);
const expectedText = serializeExpectedTextValues([expected], { normalizeWhiteSpace: true });
return await locator._expect('to.have.value', { expectedText, isNot, timeout });
}, expected, options);
}
Expand Down

0 comments on commit 2c903ee

Please sign in to comment.