Removing unnecessary tests from wlxml.js
[fnpeditor.git] / src / wlxml / wlxml.test.js
index c802ae3..bb5101f 100644 (file)
@@ -251,6 +251,42 @@ describe('WLXMLDocument', function() {
 
     });
 
+    describe('Extension', function() {
+        var doc, extension, elementNode, textNode, testClassNode;
+
+        beforeEach(function() {
+            doc = getDocumentFromXML('<section>Alice<div class="test_class"></div></section>');
+            elementNode = doc.root;
+            textNode = doc.root.contents()[0];
+            extension = {};
+            
+
+            // spr+ a expect dotyczacy object api?
+        });
+
+        it('allows adding method to an ElementNode of specific class', function() {
+            extension = {wlxmlClass: {test_class: {methods: {
+                testMethod: function() { return this; }
+            }}}};
+            doc.registerExtension(extension);
+            testClassNode = doc.root.contents()[1];
+            expect(testClassNode.object.testMethod().sameNode(testClassNode)).to.equal(true, '1');
+        });
+
+        it('allows adding transformation to an ElementNode of specific class', function() {
+            extension = {wlxmlClass: {test_class: {transformations: {
+                testTransformation: function() { return this; },
+                testTransformation2: {impl: function() { return this; }}
+            }}}};
+            doc.registerExtension(extension);
+            testClassNode = doc.root.contents()[1];
+            expect(testClassNode.object.transform('testTransformation').sameNode(testClassNode)).to.equal(true, '1');
+            expect(testClassNode.object.transform('testTransformation2').sameNode(testClassNode)).to.equal(true, '1');
+        });
+
+
+    });
+
 });
 
 });
\ No newline at end of file