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

Commit

Permalink
docs(locators.js): new examples for docs
Browse files Browse the repository at this point in the history
new examples for repeater when ng-repeat-start/end used

closes #804
  • Loading branch information
Rikhter authored and juliemr committed May 23, 2014
1 parent 147a835 commit 1adc3fa
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lib/locators.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ ProtractorBy.prototype.partialButtonText = function(searchText) {
* <span>{{cat.age}}</span>
* </div>
*
* <div class="book-img" ng-repeat-start="book in library">
* <img ng-src="{{book.imgUrl}}"></img>
* </div>
* <div class="book-info" ng-repeat-end>
* <h4>{{book.name}}</h4>
* <p>{{book.blurb}}</p>
* </div>
*
* @example
* // Returns the DIV for the second cat.
* var secondCat = element(by.repeater('cat in pets').row(1));
Expand All @@ -212,8 +220,26 @@ ProtractorBy.prototype.partialButtonText = function(searchText) {
* by.repeater('cat in pets').column('{{cat.age}}'));
*
* // Returns a promise that resolves to an array of WebElements containing
* // all rows of the repeater.
* // all top level elements repeated by the repeater. For 2 pets rows resolves
* // to an array of 2 elements.
* var rows = element.all(by.repeater('cat in pets'));
*
* // Returns a promise that resolves to an array of WebElements containing all
* // the elements with a binding to the book's name.
* var divs = element.all(by.repeater('book in library').column('book.name'));
*
* // Returns a promise that resolves to an array of WebElements containing
* // the DIVs for the second book.
* var bookInfo = element.all(by.repeater('book in library').row(1));
*
* // Returns the H4 for the first book's name.
* var firstBookName = element(by.repeater('book in library').
* row(0).column('{{book.name}}'));
*
* // Returns a promise that resolves to an array of WebElements containing
* // all top level elements repeated by the repeater. For 2 books divs
* // resolves to an array of 4 elements.
* var divs = element.all(by.repeater('book in library'));
*/
ProtractorBy.prototype.repeater = function(repeatDescriptor) {
return {
Expand Down

0 comments on commit 1adc3fa

Please sign in to comment.