Simple smartxml.Document/ElementNode.toXML
[fnpeditor.git] / src / smartxml / smartxml.test.js
index 2abdc80..6d6cbbf 100644 (file)
@@ -5,6 +5,7 @@ define([
     
 'use strict';
 /*jshint expr:true */
+/* global describe, it */
 
 var expect = chai.expect;
 
@@ -22,7 +23,7 @@ var elementNodeFromXML = function(xml) {
 };
 
 
-describe.only('smartxml', function() {
+describe('smartxml', function() {
 
     describe('Basic Document properties', function() {
         it('exposes its root element', function() {
@@ -84,6 +85,20 @@ describe.only('smartxml', function() {
 
     });
 
+    describe('Serializing document to WLXML', function() {
+        it('keeps document intact when no changes have been made', function() {
+            var xmlIn = '<section>Alice<div>has</div>a <span class="uri" meta-uri="http://cat.com">cat</span>!</section>',
+                doc = getDocumentFromXML(xmlIn),
+                xmlOut = doc.toXML();
+
+            var parser = new DOMParser(),
+                input = parser.parseFromString(xmlIn, 'application/xml').childNodes[0],
+                output = parser.parseFromString(xmlOut, 'application/xml').childNodes[0];
+            
+            expect(input.isEqualNode(output)).to.be.true;
+        });
+    });
+
 });
 
 });
\ No newline at end of file