Skip to content

Adding 'deep' option in order to compare while ignoring whitespace in text nodes#2

Merged
krampstudio merged 2 commits into
krampstudio:masterfrom
susomartinez:master
Dec 30, 2014
Merged

Adding 'deep' option in order to compare while ignoring whitespace in text nodes#2
krampstudio merged 2 commits into
krampstudio:masterfrom
susomartinez:master

Conversation

@susomartinez

Copy link
Copy Markdown

As the title says, currently an XML like:

<tag>
    Text content
</tag>

won't be equal to

<tag>Text content</tag>

So I just added the option to use the 'deep' flag in order to ignore whitespace at the beginning and end of the text nodes. It is done just setting to true the trim option in the xml2js parser.

Now, you can use expect(formattedXml).xml.to.deep.equal(unformattedXml) in order to ignore the whitespace or keep using expect(formattedXml).xml.to.not.equal(unformattedXml) in order to taking it into account.

@krampstudio

Copy link
Copy Markdown
Owner

I'll review and merge that

@krampstudio krampstudio merged commit 63188e9 into krampstudio:master Dec 30, 2014
@krampstudio

Copy link
Copy Markdown
Owner

published in 0.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants