Skip to content

Commit

Permalink
impl. NBSP support for xpath in Behat Context
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jun 19, 2023
1 parent 3630a52 commit f1afb92
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Behat/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ function ($matches) {
$selector
);

// add NBSP support for normalize-space() xpath function
$xpath = preg_replace(
'~(?<![\w\-])normalize-space\(\)~',
'normalize-space(translate($0, \'' . "\u{00a0}" . '\', \' \'))',
$xpath
);

return ['xpath', $xpath];
}

Expand Down

0 comments on commit f1afb92

Please sign in to comment.