Commit b3400aee authored by Addy Osmani's avatar Addy Osmani

Merge pull request #1080 from tastejs/browser-test-loop

Browser tests: Flatten loop
parents 2384a51c 822b030d
...@@ -113,18 +113,13 @@ function TestOperations(page) { ...@@ -113,18 +113,13 @@ function TestOperations(page) {
// obtain all the visible items // obtain all the visible items
var visibleLabels = []; var visibleLabels = [];
var tests = []; var tests = labels.map(function (label) {
for (var i = 0; i < labels.length; i++) { return label.isDisplayed().then(function (isDisplayed) {
(function (index) {
// suppressing JSHint - the loop variable is not being used in the function.
/* jshint -W083 */
tests.push(labels[index].isDisplayed().then(function (isDisplayed) {
if (isDisplayed) { if (isDisplayed) {
visibleLabels.push(labels[index]); visibleLabels.push(label);
} }
})); });
})(i); });
}
// check that they match the supplied text // check that they match the supplied text
return Q.all(tests).then(function () { return Q.all(tests).then(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment