Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

by.binding locator strategy matches sub string bindings #672

Closed
edconolly opened this issue Apr 2, 2014 · 7 comments
Closed

by.binding locator strategy matches sub string bindings #672

edconolly opened this issue Apr 2, 2014 · 7 comments

Comments

@edconolly
Copy link

If I have two bindings, where one is a sub string of the other, and the longer binding occurs first on the page it is impossible to get hold of the second binding using the by.binding locator strategy.

<ul>
  <li>{{fooBar}}</li>
  <li>{{foo}}</li>
</ul>
// Both Match and return fooBar binding
element(by.binding('foo'));
element(by.binding('fooBar'))
@juliemr
Copy link
Member

juliemr commented Apr 3, 2014

True - there should probably be a by.exactBinding or something to get around this.

Slightly-hacky trick which will work for now: element(by.binding('{{foo}}'));

@edconolly
Copy link
Author

I would have expected it the other way around, IMO by.binding should do exact matching, by.partialBinding would match foo to fooBar. Thanks for the hacky trick.

@edconolly
Copy link
Author

happy to submit a PR if you're interested in making the change?

@juliemr
Copy link
Member

juliemr commented Apr 3, 2014

@edconolly I would be OK adding an 'exactBinding' - I don't think changing (backwards-breaking) the behavior of binding would be great.

@edconolly
Copy link
Author

sure makes sense. I'll whip something up this weekend.

@hankduan
Copy link
Contributor

#812

@hankduan hankduan removed the PRs plz! label May 16, 2014
@hankduan
Copy link
Contributor

change is merged into master

@hankduan hankduan removed their assignment Nov 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants