Add Failing Test
This commit is contained in:
parent
4337ba21ae
commit
f156845afb
@ -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.");
|
||||
}
|
||||
|
13
src/test/test-data/issue-262.minified.xml
Normal file
13
src/test/test-data/issue-262.minified.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<tests><test>1.
|
||||
2.
|
||||
3.
|
||||
4.</test><test xml:space="preserve">1.
|
||||
2.
|
||||
3.
|
||||
4.</test><test>1.
|
||||
2.
|
||||
3.
|
||||
4.</test><test xml:space="preserve">1.
|
||||
2.
|
||||
3.
|
||||
4.</test></tests>
|
18
src/test/test-data/issue-262.unminified.xml
Normal file
18
src/test/test-data/issue-262.unminified.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<tests>
|
||||
<test>1.
|
||||
2.
|
||||
3.
|
||||
4.</test>
|
||||
<test xml:space="preserve">1.
|
||||
2.
|
||||
3.
|
||||
4.</test>
|
||||
<test>1.
|
||||
2.
|
||||
3.
|
||||
4.</test>
|
||||
<test xml:space="preserve">1.
|
||||
2.
|
||||
3.
|
||||
4.</test>
|
||||
</tests>
|
Loading…
Reference in New Issue
Block a user