editor: adding gap class to ui
[fnpeditor.git] / src / smartxml / smartxml.test.js
index 03befea..cbef963 100644 (file)
@@ -773,6 +773,23 @@ describe('smartxml', function() {
             expect(contents[1].contents().length).to.equal(1);
             expect(contents[1].contents()[0].getText()).to.equal('cat');
         });
+        it('removes across elements - 5 (whole document)', function() {
+            var doc = getDocumentFromXML('<div>Alice <div>has <span>a</span> cat</div>!!!</div>');
+            doc.deleteText({
+                from: {
+                    node: getTextNode('Alice ', doc),
+                    offset: 0
+                },
+                to: {
+                    node: getTextNode('!!!', doc),
+                    offset: 3
+                }
+            });
+
+            expect(doc.root.getTagName()).to.equal('div');
+            expect(doc.root.contents().length).to.equal(1);
+            expect(doc.root.contents()[0].getText()).to.equal('');
+        });
         it('removes nodes in between', function() {
             var doc = getDocumentFromXML('<div><a>aaa<x>!</x></a>xxx<x></x><b><x>!</x>bbb</b></div>');
             doc.deleteText({