From f777cccb552c25831238b94dbe164ee251aeab28 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 30 May 2020 09:28:33 +0200 Subject: [PATCH] More useful messages for assertAttrOnElements() --- test/mocha/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/mocha/utils.js b/test/mocha/utils.js index 97660d3..1035518 100644 --- a/test/mocha/utils.js +++ b/test/mocha/utils.js @@ -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}`); } } },