From: Aleksander Ɓukasz Date: Fri, 25 Oct 2013 13:39:15 +0000 (+0200) Subject: smartxml: fixing arguments name in wrapText X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/02ea7eed98a6826504c4472a9309010277026a03 smartxml: fixing arguments name in wrapText --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 7e0d9b3..b469068 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -275,7 +275,7 @@ $.extend(TextNode.prototype, { textNodeIdx: this.parent().indexOf(this), offsetStart: Math.min(desc.start, desc.end), offsetEnd: Math.max(desc.start, desc.end), - _with: {tag: desc.tagName, attrs: desc.attrs} + _with: {tagName: desc.tagName, attrs: desc.attrs} }); } else { return DocumentNode.prototype.wrapWith.call(this, desc); @@ -396,7 +396,7 @@ $.extend(Document.prototype, Backbone.Events, { throw new Error('Wrapping text in non-sibling text nodes not supported.'); } - var wrapperElement = this.createElementNode({tagName: params._with.tag, attrs: params._with.attrs}); + var wrapperElement = this.createElementNode({tagName: params._with.tagName, attrs: params._with.attrs}); textNode1.after(wrapperElement); textNode1.detach(); diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 4c9b860..e7aa8d4 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -295,7 +295,7 @@ describe('smartxml', function() { it('wraps text spanning multiple sibling TextNodes', function() { var section = elementNodeFromXML('
Alice has a small cat
'), wrapper = section.wrapText({ - _with: {tag: 'span', attrs: {'attr1': 'value1'}}, + _with: {tagName: 'span', attrs: {'attr1': 'value1'}}, offsetStart: 6, offsetEnd: 4, textNodeIdx: [0,2] @@ -307,6 +307,7 @@ describe('smartxml', function() { var wrapper2 = section.contents()[1]; expect(wrapper2.sameNode(wrapper)).to.be.true; + expect(wrapper.getTagName()).to.equal('span'); var wrapperContents = wrapper.contents(); expect(wrapperContents.length).to.equal(3);