From: Aleksander Ɓukasz Date: Tue, 16 Jul 2013 08:20:17 +0000 (+0200) Subject: Splitting text: Returning node elements involved X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/67387c5b199cba829f5f7563ff93020328cbe0ef Splitting text: Returning node elements involved --- diff --git a/modules/documentCanvas/canvas/canvas.test3.js b/modules/documentCanvas/canvas/canvas.test3.js index 705ef2c..0b71ee0 100644 --- a/modules/documentCanvas/canvas/canvas.test3.js +++ b/modules/documentCanvas/canvas/canvas.test3.js @@ -368,7 +368,7 @@ describe('Canvas', function() { section = c.doc(), text = section.children()[0].children()[0]; - text.split({offset: 5}); + var returnedValue = text.split({offset: 5}); expect(section.children().length).to.equal(2, 'section has two children'); var header1 = section.children()[0]; @@ -380,6 +380,9 @@ describe('Canvas', function() { expect(header2.getWlxmlTag()).to.equal('header', 'second section child represents wlxml header'); expect(header2.children().length).to.equal(1, 'second header has one text child'); expect(header2.children()[0].getText()).to.equal('header', 'second header has correct content'); + + expect(returnedValue.first.sameNode(header1)).to.equal(true, 'first node returnde'); + expect(returnedValue.second.sameNode(header2)).to.equal(true, 'second node returned'); }); it('leaves empty copy of DocumentNodeElement if splitting at the very beginning', function() { diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 7e5824b..aa3fd9b 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -341,6 +341,8 @@ $.extend(DocumentTextElement.prototype, { succeedingChildren.forEach(function(child) { newElement.append(child); }); + + return {first: parentElement, second: newElement}; }, });