X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/83edceffb18f5802bb6a9b20746437a3a46f2450..b3493517adea9831d8bed8bbd33422d6d8527796:/src/smartxml/smartxml.test.js
diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js
index 524c976..1be4cc1 100644
--- a/src/smartxml/smartxml.test.js
+++ b/src/smartxml/smartxml.test.js
@@ -620,9 +620,7 @@ describe('smartxml', function() {
});
it('removes parent-describing sibling nodes of unwrapped node', function() {
- var doc = getDocumentFromXML(''),
- div = doc.root.contents()[0],
- x = div.contents()[1];
+ var doc = getDocumentFromXML('');
doc.registerExtension({documentNode: {methods: {
object: {
@@ -632,6 +630,9 @@ describe('smartxml', function() {
}
}}});
+ var div = doc.root.contents()[0],
+ x = div.contents()[1];
+
div.unwrapContent();
expect(doc.root.contents().length).to.equal(2);
expect(x.isInDocument()).to.be.false;
@@ -691,10 +692,7 @@ describe('smartxml', function() {
});
it('keeps parent-describing nodes in place', function() {
- var doc = getDocumentFromXML('Alice probably has a cat'),
- root = doc.root,
- x = root.contents()[1],
- y = root.contents()[3];
+ var doc = getDocumentFromXML('Alice probably has a cat');
doc.registerExtension({documentNode: {methods: {
object: {
@@ -705,6 +703,10 @@ describe('smartxml', function() {
}
}}});
+ var root = doc.root,
+ x = root.contents()[1],
+ y = root.contents()[3];
+
root.wrapText({
_with: {tagName: 'span', attrs: {'attr1': 'value1'}},
offsetStart: 1,
@@ -765,10 +767,7 @@ describe('smartxml', function() {
});
it('keeps parent-describing nodes in place', function() {
- var section = elementNodeFromXML(''),
- aliceText = section.contents()[0],
- x = section.contents()[1],
- lastDiv = section.contents()[2];
+ var section = elementNodeFromXML('');
section.document.registerExtension({documentNode: {methods: {
object: {
@@ -778,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,
@@ -1348,19 +1351,6 @@ describe('smartxml', function() {
beforeEach(function() {
doc = getDocumentFromXML('');
- elementNode = doc.root;
- textNode = doc.root.contents()[0];
- extension = {};
-
- expect(elementNode.testTransformation).to.be.undefined;
- expect(textNode.testTransformation).to.be.undefined;
- expect(doc.testTransformation).to.be.undefined;
-
- expect(doc.testMethod).to.be.undefined;
- expect(elementNode.testMethod).to.be.undefined;
- expect(textNode.testMethod).to.be.undefined;
- expect(elementNode.elementTestMethod).to.be.undefined;
- expect(textNode.textTestMethod).to.be.undefined;
});
it('allows adding method to a document', function() {
@@ -1404,7 +1394,6 @@ describe('smartxml', function() {
doc.registerExtension(extension);
- /* refresh */
elementNode = doc.root;
textNode = doc.root.contents()[0];
@@ -1440,7 +1429,6 @@ describe('smartxml', function() {
doc.registerExtension(extension);
- /* refresh */
elementNode = doc.root;
textNode = doc.root.contents()[0];