From: Aleksander Ɓukasz Date: Mon, 27 Jan 2014 10:33:24 +0000 (+0100) Subject: smartxml: additional test for Document.deleteText X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/9e4ef8a51fbe1e5df22334bc63276f9ffbaade73?hp=fd5607f0a5ffb5f37df8a53a8b50d72ec6a4f8b9 smartxml: additional test for Document.deleteText --- diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 03befea..cbef963 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -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('
Alice
has a cat
!!!
'); + 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('
aaa!xxx!bbb
'); doc.deleteText({