diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts index be01e22..8ab4884 100644 --- a/src/test/extension.test.ts +++ b/src/test/extension.test.ts @@ -21,7 +21,8 @@ describe("V2XmlFormatter", () => { newLine: "\r\n", removeCommentsOnMinify: false, splitAttributesOnFormat: false, - splitXmlnsOnFormat: true + splitXmlnsOnFormat: true, + preserveSpacesBetweenAttributes: false }; it("should handle basic XML", () => { @@ -111,6 +112,14 @@ describe("V2XmlFormatter", () => { it("should handle mixed content on the same line as another element without error", () => { testFormatter(xmlFormatter, options, "issue-294"); }); + + it("should optionally preserve whitespace between attributes", () => { + options.preserveSpacesBetweenAttributes = true; + + testFormatter(xmlFormatter, options, "issue-308"); + + options.preserveSpacesBetweenAttributes = false; + }); }); describe("#minifyXml(xml, options)", () => { @@ -124,7 +133,8 @@ describe("V2XmlFormatter", () => { newLine: "\r\n", removeCommentsOnMinify: false, splitAttributesOnFormat: false, - splitXmlnsOnFormat: true + splitXmlnsOnFormat: true, + preserveSpacesBetweenAttributes: false }; it("should preserve whitespace on minify if xml:space is set to 'preserve-whitespace'", () => { diff --git a/src/test/test-data/issue-308.formatted.xml b/src/test/test-data/issue-308.formatted.xml new file mode 100644 index 0000000..1764642 --- /dev/null +++ b/src/test/test-data/issue-308.formatted.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/test-data/issue-308.unformatted.xml b/src/test/test-data/issue-308.unformatted.xml new file mode 100644 index 0000000..1764642 --- /dev/null +++ b/src/test/test-data/issue-308.unformatted.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file