Skip to content

Commit ee35d8c

Browse files
committed
Also support DOCUMENT_FRAGMENT_NODE in UnitTester.
So far only text nodes and elements could be compared. With this patch document fragments can also be compared.
1 parent 4ac9d43 commit ee35d8c

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

webodf/tests/core/UnitTester.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -320,21 +320,24 @@ core.UnitTestRunner = function UnitTestRunner(resourcePrefix, logger) {
320320
+ "' should be '" + /**@type{!Text}*/(b).data + "'");
321321
return false;
322322
}
323-
runtime.assert(atype === Node.ELEMENT_NODE,
324-
"Only textnodes and elements supported.");
325-
if (a.namespaceURI !== b.namespaceURI) {
326-
testFailed("namespace '" + a.namespaceURI + "' should be '"
327-
+ b.namespaceURI + "'");
328-
return false;
329-
}
330-
if (a.localName !== b.localName) {
331-
testFailed("localName '" + a.localName + "' should be '"
332-
+ b.localName + "'");
333-
return false;
334-
}
335-
if (!areAttributesEqual(/**@type{!Element}*/(a),
336-
/**@type{!Element}*/(b), false)) {
337-
return false;
323+
if (atype === Node.ELEMENT_NODE) {
324+
if (a.namespaceURI !== b.namespaceURI) {
325+
testFailed("namespace '" + a.namespaceURI + "' should be '"
326+
+ b.namespaceURI + "'");
327+
return false;
328+
}
329+
if (a.localName !== b.localName) {
330+
testFailed("localName '" + a.localName + "' should be '"
331+
+ b.localName + "'");
332+
return false;
333+
}
334+
if (!areAttributesEqual(/**@type{!Element}*/(a),
335+
/**@type{!Element}*/(b), false)) {
336+
return false;
337+
}
338+
} else {
339+
runtime.assert(atype === Node.DOCUMENT_FRAGMENT_NODE,
340+
"Only textnodes, elements and document-fragments are supported.");
338341
}
339342
an = a.firstChild;
340343
bn = b.firstChild;

0 commit comments

Comments
 (0)