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

Commit

Permalink
feat(ElementArrayFinder): keep a reference to the original locator
Browse files Browse the repository at this point in the history
  • Loading branch information
elgalu authored and juliemr committed Aug 20, 2014
1 parent 0da1e0c commit 25cf88c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ var buildElementHelper = function(ptor) {
this.parentElementFinder_ = opt_parentElementFinder || null;
};

/**
* @return {webdriver.Locator}
*/
ElementArrayFinder.prototype.locator = function() {
return this.locator_;
};

/**
* Returns the array of WebElements represented by this ElementArrayFinder.
*
Expand Down
9 changes: 9 additions & 0 deletions spec/basic/elements_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ describe('ElementFinder', function() {
});
});

it('should keep a reference to the array original locator', function() {
var byCss = by.css('.menu li a');
var byModel = by.model('color');
browser.get('index.html#/form');

expect(element.all(byCss).locator()).toEqual(byCss);
expect(element.all(byModel).locator()).toEqual(byModel);
});

it('should map each element on array and with promises', function() {
browser.get('index.html#/form');
var labels = element.all(by.css('.menu li a')).map(function(elm, index) {
Expand Down

0 comments on commit 25cf88c

Please sign in to comment.