Skip to content

Commit

Permalink
Merge pull request #149 from notengrafik/pr/assertAttrOnElements-mess…
Browse files Browse the repository at this point in the history
…ages

More useful messages for assertAttrOnElements()
  • Loading branch information
annplaksin authored Feb 15, 2022
2 parents e6bd3aa + f777ccc commit 7089def
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 7089def

Please sign in to comment.