Skip to content

Commit

Permalink
Merge 9e2ab35 into 7bc7c8a
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Nov 25, 2019
2 parents 7bc7c8a + 9e2ab35 commit f52980a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module.exports = {
);
},
equal(a, b) {
return a.nodeValue === b.nodeValue;
return a.nodeType === b.nodeType && a.nodeValue === b.nodeValue;
},
inspect(element, depth, output) {
return output.code(
Expand Down
25 changes: 25 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,31 @@ describe('unexpected-dom', () => {
`
);
});

describe('on nodes of different types', () => {
it('should fail', () => {
expect(
() => {
expect(
parseHtmlNode(
'<ul><li>John</li><li class="winner">Jane</li><li>Annie</li></ul>'
),
'to equal',
parseHtmlDocument(
'<!DOCTYPE html><html><body><h1>Tournament</h1><ul><li>John</li><li>Jane</li><li class="winner">Annie</li></ul></body></html>'
)
);
},
'to throw an error satisfying to equal snapshot',
expect.unindent`
expected <ul><li>John</li><li class="winner">Jane</li><li>Annie</li></ul>
to equal <!DOCTYPE html><html><head></head><body>...</body></html>
Mismatching constructors HTMLUListElement should be Document
`
);
});
});
});

describe('on text nodes', () => {
Expand Down

0 comments on commit f52980a

Please sign in to comment.