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

Commit 316add0

Browse files
committed
docs(locators): add info on interpolation markers for by.binding
See #1480
1 parent d505249 commit 316add0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/locators.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ ProtractorBy.prototype.addLocator = function(name, script) {
7878
};
7979

8080
/**
81-
* Find an element by binding.
81+
* Find an element by binding. Does a partial match, so any elements bound to
82+
* variables containing the input string will be returned.
83+
*
84+
* Note: For AngularJS version 1.2, the interpolation brackets, usually {{}},
85+
* are allowed in the binding description string. For Angular version 1.3, they
86+
* are not allowed, and no elements will be found if they are used.
8287
*
8388
* @view
8489
* <span>{{person.name}}</span>
@@ -91,6 +96,13 @@ ProtractorBy.prototype.addLocator = function(name, script) {
9196
* var span2 = element(by.binding('person.email'));
9297
* expect(span2.getText()).toBe('[email protected]');
9398
*
99+
* // You can also use a substring for a partial match
100+
* var span1alt = element(by.binding('name'));
101+
* expect(span1alt.getText()).toBe('Foo');
102+
*
103+
* // This works for sites using Angular 1.2 but NOT 1.3
104+
* var deprecatedSyntax = element(by.binding('{{person.name}}'));
105+
*
94106
* @param {string} bindingDescriptor
95107
* @return {{findElementsOverride: findElementsOverride, toString: Function|string}}
96108
*/

0 commit comments

Comments
 (0)