From 4cc5c32a129186676719dfe8502275f789c34d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20M=C3=BCller?= Date: Tue, 10 Mar 2015 12:11:41 +0100 Subject: [PATCH] Fix linter errors --- lib/index.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) 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;