diff --git a/lib/index.js b/lib/index.js index bc646eb7..28085d7b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -68,18 +68,6 @@ function stringifyEndTag(element) { return ''; } -function stringifyElement(element) { - var elementName = element.nodeName.toLowerCase(); - var str = stringifyStartTag(element); - if (!isVoidElement(elementName)) { - if (element.children.length > 0) { - str += '...'; - } - str += stringifyEndTag(element); - } - return str; -} - module.exports = { name: 'unexpected-dom', installInto: function (expect) { @@ -272,7 +260,7 @@ module.exports = { changes.forEach(function (diffItem, index) { output.i().block(function () { var type = diffItem.type; - var last = !!diffItem.last; + // var last = !!diffItem.last; if (type === 'insert') { this.annotationBlock(function () { @@ -302,12 +290,13 @@ module.exports = { } if (isVoidElement(actual.nodeName) && actual.childNodes.length === 0 && expected.childNodes.length === 0) { + return result; + } + + if (actual.nodeName.toLowerCase() === expected.nodeName.toLowerCase()) { + output.code(stringifyEndTag(actual), 'html'); } else { - if (actual.nodeName.toLowerCase() === expected.nodeName.toLowerCase()) { - output.code(stringifyEndTag(actual), 'html'); - } else { - output.append(diff(stringifyEndTag(actual), stringifyEndTag(expected)).diff); - } + output.append(diff(stringifyEndTag(actual), stringifyEndTag(expected)).diff); } return result;