Skip to content

Commit

Permalink
More useful messages for assertAttrOnElements()
Browse files Browse the repository at this point in the history
  • Loading branch information
th-we committed May 30, 2020
1 parent fa60cb9 commit f777ccc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/mocha/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module.exports = {
assertAttrOnElements: function(elements, indices, attName, expectedValue) {
for (let i = 0; i < elements.length; i += 1) {
const actualValue = elements[i].getAttribute(attName);
const elementDescription = 'element index ' + i + ' (' + elements[i].localName + ')' + ' ("' + elements[i].innerHTML + '")';
const elementDescription = 'element index ' + i + ' (' + elements[i].localName + ')' + ' ("' + elements[i].outerHTML + '")';
if (indices.indexOf(i) >= 0) {
assert.strictEqual(actualValue, expectedValue, 'value not found on ' + elementDescription);
assert.strictEqual(actualValue, expectedValue, `value for ${attName} not found on ${elementDescription}`);
} else {
assert.notEqual(actualValue, expectedValue, 'value unexpectedly found on ' + elementDescription);
assert.notEqual(actualValue, expectedValue, `value for ${attName} unexpectedly found on ${elementDescription}`);
}
}
},
Expand Down

0 comments on commit f777ccc

Please sign in to comment.