X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5145fc38a6bf044367f4d96197dd3d47e05b6266..5a57bc3cb22f2cb424186d8a7992d7dc7af68326:/src/smartxml/smartxml.test.js diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 524c976..93c401b 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, @@ -1348,19 +1350,6 @@ describe('smartxml', function() { beforeEach(function() { doc = getDocumentFromXML('
Alice
'); - 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 +1393,6 @@ describe('smartxml', function() { doc.registerExtension(extension); - /* refresh */ elementNode = doc.root; textNode = doc.root.contents()[0]; @@ -1440,7 +1428,6 @@ describe('smartxml', function() { doc.registerExtension(extension); - /* refresh */ elementNode = doc.root; textNode = doc.root.contents()[0];