This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$$testability: Unexpected behaviour of findBindings
with exactMatch === true
#9595
Milestone
$$testability.findBindings
withopt_exactMatch
set to true, uses a RegExp to match the specified expression against an element's bindings which results into unexpected (wrong?) behaviour.The main problem is that is does not account for characters with special meaning in the context of a regular expression (e.g.
$
,|
etc), which results in matching errors:E.g. trying to match against the binding
$index
will produce the following RegExp:/(^|\s)$index(\s|\||$)/
(which will always fail).Or trying to match against any binding with a filter will yield unexpected matches (due to the
|
character).E.g. trying to match against
myValue | transformed
will result into the following RegExp:/(^|\s)myValue | transformed(\s|\||$)/
(which would (among other things) erroneously match all bindings starting withmyValue
).Off the top of my head, either escaping
expression
or using string comparison with some additional checks (for leading/trailing characters) would solve this problem, but I am not sure what path we want to go down.Alternatively, it should be documented somewhere (in protractor's docs?) that trying to do exact matching by binding has certain limitations.
The text was updated successfully, but these errors were encountered: