Merge pull request #276 from DotJoshJohnson/bug/issue-257
Fix Issue 257
This commit is contained in:
		
						commit
						a156dd7df7
					
				
					 5 changed files with 47 additions and 3 deletions
				
			
		
							
								
								
									
										2
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "name": "xml",
 | 
					    "name": "xml",
 | 
				
			||||||
    "version": "2.3.2",
 | 
					    "version": "2.4.0",
 | 
				
			||||||
    "lockfileVersion": 1,
 | 
					    "lockfileVersion": 1,
 | 
				
			||||||
    "requires": true,
 | 
					    "requires": true,
 | 
				
			||||||
    "dependencies": {
 | 
					    "dependencies": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,7 +224,9 @@ export class V2XmlFormatter implements XmlFormatter {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // entering EndTag
 | 
					            // entering EndTag
 | 
				
			||||||
            else if (isLocation(Location.Text) && cc === "<" && nc === "/") {
 | 
					            else if (isLocation(Location.Text) && cc === "<" && nc === "/") {
 | 
				
			||||||
                indentLevel--;
 | 
					                if (!inMixedContent) {
 | 
				
			||||||
 | 
					                    indentLevel--;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                refreshMixedContentFlag();
 | 
					                refreshMixedContentFlag();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ describe("V2XmlFormatter", () => {
 | 
				
			||||||
            testFormatter(xmlFormatter, options, "preformatted");
 | 
					            testFormatter(xmlFormatter, options, "preformatted");
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it ("should preserve line breaks between elements", () => {
 | 
					        it("should preserve line breaks between elements", () => {
 | 
				
			||||||
            testFormatter(xmlFormatter, options, "preserve-breaks");
 | 
					            testFormatter(xmlFormatter, options, "preserve-breaks");
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,6 +95,10 @@ describe("V2XmlFormatter", () => {
 | 
				
			||||||
        it("should not remove spaces between the node name and the first attribute within CDATA", () => {
 | 
					        it("should not remove spaces between the node name and the first attribute within CDATA", () => {
 | 
				
			||||||
            testFormatter(xmlFormatter, options, "issue-227");
 | 
					            testFormatter(xmlFormatter, options, "issue-227");
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        it("should handle mixed content as a child of another element", () => {
 | 
				
			||||||
 | 
					            testFormatter(xmlFormatter, options, "issue-257");
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/test/test-data/issue-257.formatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/test/test-data/issue-257.formatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<xsl:stylesheet version="2.0" 
 | 
				
			||||||
 | 
					    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 | 
				
			||||||
 | 
					    <xsl:output method="xml" encoding="UTF-8" indent="yes" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <xsl:template match="/">
 | 
				
			||||||
 | 
					        <file>
 | 
				
			||||||
 | 
					            <xsl:apply-templates />
 | 
				
			||||||
 | 
					        </file>
 | 
				
			||||||
 | 
					    </xsl:template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <xsl:template match="*">
 | 
				
			||||||
 | 
					        <xsl:message terminate="no">
 | 
				
			||||||
 | 
					            WARNING: Unmatched element: <xsl:value-of select="name()"/>
 | 
				
			||||||
 | 
					        </xsl:message>
 | 
				
			||||||
 | 
					        <xsl:apply-templates/>
 | 
				
			||||||
 | 
					    </xsl:template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</xsl:stylesheet>
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/test/test-data/issue-257.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/test/test-data/issue-257.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<xsl:stylesheet version="2.0" 
 | 
				
			||||||
 | 
					    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 | 
				
			||||||
 | 
					    <xsl:output method="xml" encoding="UTF-8" indent="yes" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <xsl:template match="/">
 | 
				
			||||||
 | 
					        <file>
 | 
				
			||||||
 | 
					            <xsl:apply-templates />
 | 
				
			||||||
 | 
					        </file>
 | 
				
			||||||
 | 
					    </xsl:template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <xsl:template match="*">
 | 
				
			||||||
 | 
					        <xsl:message terminate="no">
 | 
				
			||||||
 | 
					            WARNING: Unmatched element: <xsl:value-of select="name()"/>
 | 
				
			||||||
 | 
					        </xsl:message>
 | 
				
			||||||
 | 
					        <xsl:apply-templates/>
 | 
				
			||||||
 | 
					    </xsl:template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</xsl:stylesheet>
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue