X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/35abf5d5c78b517329e313b1158f8b980940acd6..e5ac28c20d0e89d662c6fcf5da4ecc87f8011211:/modules/documentCanvas/canvas/canvas.test3.js diff --git a/modules/documentCanvas/canvas/canvas.test3.js b/modules/documentCanvas/canvas/canvas.test3.js index b6cc42e..76550cd 100644 --- a/modules/documentCanvas/canvas/canvas.test3.js +++ b/modules/documentCanvas/canvas/canvas.test3.js @@ -116,6 +116,33 @@ describe('Canvas', function() { }); }) + describe('manipulation api', function() { + describe('wrapping', function() { + it('wraps DocumentNodeElement', function() { + var c = canvas.fromXML('
'), + div = c.doc().children()[0]; + + var returned = div.wrapWithNodeElement({tag: 'header', klass: 'some.class'}), + parent = div.parent(), + parent2 = c.doc().children()[0]; + + expect(returned.sameNode(parent)).to.be.true; + expect(returned.sameNode(parent2)).to.be.true; + }); + it('wraps DocumentTextElement', function() { + var c = canvas.fromXML('
Alice
'), + text = c.doc().children()[0]; + + var returned = text.wrapWithNodeElement({tag: 'header', klass: 'some.class'}), + parent = text.parent(), + parent2 = c.doc().children()[0]; + + expect(returned.sameNode(parent)).to.be.true; + expect(returned.sameNode(parent2)).to.be.true; + }); + }) + }); + }); });