A suite to track Project Diva score statistics and ratings / D4DJ event data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
projectdivar/server/node_modules/xmldom/test/dom/clone.js

22 lines
1000 B

var wows = require('vows');
var XMLSerializer = require('xmldom').XMLSerializer;
var DOMParser = require('xmldom').DOMParser;
// Create a Test Suite
wows.describe('XML Namespace Parse').addBatch({
'clone': function () {
var doc1 = new DOMParser().parseFromString("<doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1>",'text/xml')
var n =doc1.cloneNode(true)
console.assert(n == new XMLSerializer().serializeToString(doc1))
},
'import': function () {
var doc1 = new DOMParser().parseFromString("<doc2 attr='2'/>")
var doc2 = new DOMParser().parseFromString("<doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1>",'text/xml')
var doc3 = new DOMParser().parseFromString("<doc2 attr='2'><doc1 attr1='1' attr2='a2'>text1<child>text2</child></doc1></doc2>")
var n =doc1.importNode(doc2.documentElement, true)
doc1.documentElement.appendChild(n)
console.assert(doc1 == doc3+'')
console.assert(doc2 != doc3+'')
}
}).run(); // Run it