Reputation: 11669
I can't find what the column method is actually doing in the docs. Does someone know what it's really doing?
Here is my code:
var phoneNameColumn = element.all(by.repeater('phone in phones').column('phone.name'));
var query = element(by.model('query'));
function getNames() {
return phoneNameColumn.map(function(elm) {
return elm.getText();
});
}
query.sendKeys('tablet'); //let's narrow the dataset to make the test assertions shorter
expect(getNames()).toEqual([
"Motorola XOOM\u2122 with Wi-Fi",
"MOTOROLA XOOM\u2122"
]);
Upvotes: 2
Views: 768
Reputation: 474231
column()
is basically a convenience method to get the columns from a repeater by binding. If you imagine a table formed by a repeater, columns would correspond to your model fields, rows - to model instances.
For example, if you want to get all book name elements from the repeater:
element.all(by.repeater('book in library').column('book.name'));
You can also get a single book name element in a specific row:
element(by.repeater('book in library').row(0).column('book.name'));
Upvotes: 4