diff --git a/src/formatters/lint-xml.js b/src/formatters/lint-xml.js index 10155399..00db0d90 100644 --- a/src/formatters/lint-xml.js +++ b/src/formatters/lint-xml.js @@ -39,7 +39,7 @@ CSSLint.addFormatter({ * - & is the escape sequence for & * - < is the escape sequence for < * - > is the escape sequence for > - * + * * @param {String} message to escape * @return escaped message as {String} */ @@ -51,13 +51,17 @@ CSSLint.addFormatter({ }; if (messages.length > 0) { - + output.push(""); CSSLint.Util.forEach(messages, function (message, i) { if (message.rollup) { output.push(""); } else { - output.push(""); } }); diff --git a/tests/formatters/lint-xml.js b/tests/formatters/lint-xml.js index 7e1a6a14..d41f936e 100644 --- a/tests/formatters/lint-xml.js +++ b/tests/formatters/lint-xml.js @@ -6,7 +6,7 @@ YUITest.TestRunner.add(new YUITest.TestCase({ name: "Lint XML formatter test", - + "File with no problems should say so": function(){ var result = { messages: [], stats: [] }, expected = ""; @@ -38,6 +38,25 @@ expected = "" + file + error1 + error2 + "", actual = CSSLint.format(result, "FILE", "lint-xml"); Assert.areEqual(expected, actual); + }, + + "Messages should include rule IDs": function() { + var result = { messages: [ + { type: "error", line: 1, col: 1, message: "X", evidence: "Y", rule: { id: "Z" } } + ], stats: [] }; + + var expected = + '' + + '' + + '' + + '' + + '' + + ''; + + var actual = CSSLint.format(result, "FILE", "lint-xml"); + + Assert.areEqual(expected, actual); } + })); })();