forked from external/vscode-xml
Add Test
This commit is contained in:
parent
c36509902e
commit
db108a9db6
3 changed files with 34 additions and 2 deletions
|
@ -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'", () => {
|
||||
|
|
11
src/test/test-data/issue-308.formatted.xml
Normal file
11
src/test/test-data/issue-308.formatted.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<object type="output parameters">
|
||||
<!-- output directory -->
|
||||
<param name="output directory" type="string" default="output"></param>
|
||||
<!-- output files -->
|
||||
<param name="crystal file" required="false" type="string" default="Slime_-_crystals"></param>
|
||||
<param name="macrocell file" required="false" type="string" default="Slime_-_macrocells"></param>
|
||||
<param name="macrolayer file" required="false" type="string" default="Slime_-_macrolayers"></param>
|
||||
<param name="area file" required="false" type="string" default="Nerd_-_Area"></param>
|
||||
<param name="final stack file" required="false" type="string" default="Mads_-_Final_Stack"></param>
|
||||
<param name="all stacks file" required="false" type="string" default="Mads_-_All_Stacks"></param>
|
||||
</object>
|
11
src/test/test-data/issue-308.unformatted.xml
Normal file
11
src/test/test-data/issue-308.unformatted.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<object type="output parameters">
|
||||
<!-- output directory -->
|
||||
<param name="output directory" type="string" default="output"></param>
|
||||
<!-- output files -->
|
||||
<param name="crystal file" required="false" type="string" default="Slime_-_crystals"></param>
|
||||
<param name="macrocell file" required="false" type="string" default="Slime_-_macrocells"></param>
|
||||
<param name="macrolayer file" required="false" type="string" default="Slime_-_macrolayers"></param>
|
||||
<param name="area file" required="false" type="string" default="Nerd_-_Area"></param>
|
||||
<param name="final stack file" required="false" type="string" default="Mads_-_Final_Stack"></param>
|
||||
<param name="all stacks file" required="false" type="string" default="Mads_-_All_Stacks"></param>
|
||||
</object>
|
Loading…
Add table
Reference in a new issue