X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/cb97894506c25210fd9267397023c3adfb312a2c..d6174a70be823dd5772d845b83e11d0b779ab513:/modules/documentCanvas/tests/canvas.test.js diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js index 53f4aee..5dc017b 100644 --- a/modules/documentCanvas/tests/canvas.test.js +++ b/modules/documentCanvas/tests/canvas.test.js @@ -76,6 +76,35 @@ define([ c.nodeWrap({inside: header, _with: wrapper, offsetStart: 6, offsetEnd: 4, textNodeIdx: [0,2]}); assertDomEqual(c.getContent(), '
Alice has a small cat
'); }); + + test('unwrap text', function() { + var c = canvas.create('
Alice has a cat
'); + var span = c.findNodes({tag:'span'})[0]; + c.nodeUnwrap({node: span}); + assertDomEqual(c.getContent(), '
Alice has a cat
'); + }); + + test('unwrap text - first text node', function() { + var c = canvas.create('
Alice has a cat
'); + var span = c.findNodes({tag:'span'})[0]; + c.nodeUnwrap({node: span}); + assertDomEqual(c.getContent(), '
Alice has a cat
'); + }); + + test('unwrap text - only text node', function() { + var c = canvas.create('
Alice
'); + var span = c.findNodes({tag:'span'})[0]; + c.nodeUnwrap({node: span}); + assertDomEqual(c.getContent(), '
Alice
'); + }); + + + test('unwrap text - non text neighbours', function() { + var c = canvas.create('
a
Alice
b
'); + var span = c.findNodes({tag:'span'})[0]; + c.nodeUnwrap({node: span}); + assertDomEqual(c.getContent(), '
a
Alice
b
'); + }); test('split node', function() { var c = canvas.create('
Header 1
');