diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts
index a4368e9..77ef70e 100644
--- a/src/test/extension.test.ts
+++ b/src/test/extension.test.ts
@@ -101,6 +101,26 @@ describe("V2XmlFormatter", () => {
});
});
+ describe("#minifyXml(xml, options)", () => {
+
+ const options = {
+ editorOptions: {
+ insertSpaces: true,
+ tabSize: 4
+ },
+ enforcePrettySelfClosingTagOnFormat: false,
+ newLine: "\r\n",
+ removeCommentsOnMinify: false,
+ splitAttributesOnFormat: false,
+ splitXmlnsOnFormat: true
+ };
+
+ it("should preserve whitespace on minify if xml:space is set to 'preserve-whitespace'", () => {
+ testMinifier(xmlFormatter, options, "issue-262");
+ });
+
+ });
+
});
function testFormatter(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
@@ -111,3 +131,12 @@ function testFormatter(xmlFormatter: XmlFormatter, options: XmlFormattingOptions
assert.equal(actualFormattedXml, expectedFormattedXml, "Actual formatted XML does not match expected formatted XML.");
}
+
+function testMinifier(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
+ const expectedMinifiedXml = TestDataLoader.load(`${fileLabel}.minified.xml`);
+ const unminifiedXml = TestDataLoader.load(`${fileLabel}.unminified.xml`);
+
+ const actualMinifiedXml = xmlFormatter.minifyXml(unminifiedXml, options);
+
+ assert.equal(actualMinifiedXml, expectedMinifiedXml, "Actual minified XML does not match expected minified XML.");
+}
diff --git a/src/test/test-data/issue-262.minified.xml b/src/test/test-data/issue-262.minified.xml
new file mode 100644
index 0000000..beed2a0
--- /dev/null
+++ b/src/test/test-data/issue-262.minified.xml
@@ -0,0 +1,13 @@
+1.
+2.
+3.
+4.1.
+2.
+3.
+4.1.
+ 2.
+ 3.
+ 4.1.
+ 2.
+ 3.
+ 4.
\ No newline at end of file
diff --git a/src/test/test-data/issue-262.unminified.xml b/src/test/test-data/issue-262.unminified.xml
new file mode 100644
index 0000000..023f4e0
--- /dev/null
+++ b/src/test/test-data/issue-262.unminified.xml
@@ -0,0 +1,18 @@
+
+1.
+2.
+3.
+4.
+1.
+2.
+3.
+4.
+1.
+ 2.
+ 3.
+ 4.
+1.
+ 2.
+ 3.
+ 4.
+
\ No newline at end of file