editor - popup for inserting/editing links
[fnpeditor.git] / src / smartxml / smartxml.test.js
index 491c586..8f7deb6 100644 (file)
@@ -220,6 +220,7 @@ describe('smartxml', function() {
                     expect(node.contents()).to.have.length(1);
                 });
             });
                     expect(node.contents()).to.have.length(1);
                 });
             });
+        });
 
         describe('Setting node attributes', function() {
             it('can set node attribute', function() {
 
         describe('Setting node attributes', function() {
             it('can set node attribute', function() {
@@ -242,8 +243,6 @@ describe('smartxml', function() {
                 expect(event.meta.oldVal).to.equal('value1');
             });
         });
                 expect(event.meta.oldVal).to.equal('value1');
             });
         });
-
-        });
     });
 
     describe('Basic TextNode properties', function() {
     });
 
     describe('Basic TextNode properties', function() {
@@ -1632,6 +1631,24 @@ describe('smartxml', function() {
                 expect(doc.root.getAttr('smart')).to.equal('1');
                 expect(doc.root.getAttr('unaware')).to.equal('1');
             });
                 expect(doc.root.getAttr('smart')).to.equal('1');
                 expect(doc.root.getAttr('unaware')).to.equal('1');
             });
+
+            it('can have associated metadata', function() {
+                var doc = getDocumentFromXML('<div></div>'),
+                    metadata = Object.create({});
+
+                doc.registerExtension({document: {transformations: {
+                    test: function() {
+                        this.trigger('change');
+                    }
+                }}});
+
+                doc.startTransaction(metadata);
+                doc.test();
+                doc.endTransaction();
+
+                var transaction = doc.undoStack[0];
+                expect(transaction.metadata).to.equal(metadata);
+            });
         });
 
         describe('Regression tests', function() {
         });
 
         describe('Regression tests', function() {