X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/59425d79741dd5746a76dab417aade4986c88d99..b20691e774cac0cbf2ee174472a1b1dbc94fa61b:/modules/documentCanvas/tests/canvas.test.js diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js index 57fb308..12fb8a5 100644 --- a/modules/documentCanvas/tests/canvas.test.js +++ b/modules/documentCanvas/tests/canvas.test.js @@ -61,6 +61,22 @@ define([ assertDomEqual(c.getContent(), '
Header 1
'); }); + test('wrap text in node - text not a first node', function() { + var c = canvas.create('
Alice has a cat
'); + var header = c.findNodes({tag: 'header'})[0]; + var wrapper = canvasNode.create({tag: 'aside'}); + c.nodeWrap({inside: header, _with: wrapper, offsetStart: 1, offsetEnd: 4, textNodeIdx: 2}); + assertDomEqual(c.getContent(), '
Alice has a cat
'); + }); + + test('wrap text with nodes inside', function() { + var c = canvas.create('
Alice has a small cat
'); + var header = c.findNodes({tag: 'header'})[0]; + var wrapper = canvasNode.create({tag: 'aside'}); + c.nodeWrap({inside: header, _with: wrapper, offsetStart: 6, offsetEnd: 4, textNodeIdx: [0,2]}) + assertDomEqual(c.getContent(), '
Alice has a small cat
'); + }); + test('split node', function() { var c = canvas.create('
Header 1
'); var header = c.findNodes({tag: 'header'})[0]; @@ -205,7 +221,7 @@ define([ assertDomEqual(c.getContent(), utils.cleanUp('\
\
alice
\ -
\ +
\
\
cat
\
dog
\