From db108a9db603cad2528d15bf28b6f42a2ab671ae Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Wed, 25 Nov 2020 22:25:21 -0500 Subject: [PATCH] Add Test --- src/test/extension.test.ts | 14 ++++++++++++-- src/test/test-data/issue-308.formatted.xml | 11 +++++++++++ src/test/test-data/issue-308.unformatted.xml | 11 +++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/test/test-data/issue-308.formatted.xml create mode 100644 src/test/test-data/issue-308.unformatted.xml 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