X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/65bc0821986afa202fcb6b7e8e77661f951b808d..0032858d24ed6dba11f8943072cd6db475a2dd17:/src/smartxml/smartxml.test.js
diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js
index 822243d..e4dd1a7 100644
--- a/src/smartxml/smartxml.test.js
+++ b/src/smartxml/smartxml.test.js
@@ -61,6 +61,22 @@ describe('smartxml', function() {
});
});
+ describe('DocumentNode', function() {
+ it('can be cloned', function() {
+ var doc = getDocumentFromXML('
Alice
'),
+ text = doc.root.contents()[0],
+ clone, suffix;
+
+ [doc.root, text].forEach(function(node) {
+ suffix = ' (' + (node.nodeType === Node.TEXT_NODE ? 'text' : 'element') + ')';
+ clone = node.clone();
+ expect(doc.containsNode(clone)).to.equal(false, 'clone is not contained in a document' + suffix);
+ expect(node.sameNode(clone)).to.equal(false, 'clone is not same node as its originator' + suffix);
+ expect(node.nativeNode.isEqualNode(clone.nativeNode)).to.equal(true, 'clone is identical as its originator' + suffix);
+ });
+ });
+ });
+
describe('Basic ElementNode properties', function() {
it('exposes node contents', function() {
var node = elementNodeFromXML('Sometextis here'),