smartxml: fix tests - extensions needs to be registered before querying nodes
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 23 Jun 2014 13:12:35 +0000 (15:12 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Jul 2014 09:47:37 +0000 (11:47 +0200)
src/smartxml/smartxml.test.js

index 93c401b..1be4cc1 100644 (file)
@@ -767,10 +767,7 @@ describe('smartxml', function() {
             });
 
             it('keeps parent-describing nodes in place', function() {
             });
 
             it('keeps parent-describing nodes in place', function() {
-                var section = elementNodeFromXML('<section>Alice<x></x><div>a cat</div></section>'),
-                    aliceText = section.contents()[0],
-                    x = section.contents()[1],
-                    lastDiv = section.contents()[2];
+                var section = elementNodeFromXML('<section>Alice<x></x><div>a cat</div></section>');
 
                 section.document.registerExtension({documentNode: {methods: {
                     object: {
 
                 section.document.registerExtension({documentNode: {methods: {
                     object: {
@@ -780,6 +777,10 @@ describe('smartxml', function() {
                     }
                 }}});
 
                     }
                 }}});
 
+                var aliceText = section.contents()[0],
+                    x = section.contents()[1],
+                    lastDiv = section.contents()[2];
+
                 section.document.wrapNodes({
                         node1: aliceText,
                         node2: lastDiv,
                 section.document.wrapNodes({
                         node1: aliceText,
                         node2: lastDiv,