X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a398f2a96740ebe6dd60559d90e74c648e7009af..f17e9178a91a7df96fd252f66e058e880eac8932:/modules/documentCanvas/tests/canvas.test.js diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js index a9ed767..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
'); @@ -260,6 +289,38 @@ define([ ')); + }); + + test('removing list containing nested list', function() { + var nestedList = utils.cleanUp('\ +
\ +
\ +
alice
\ +
\ +
\ +
cat
\ +
dog
\ +
\ +
\ +
bee
\ +
\ +
'); + + var c = canvas.create(nestedList); + var alice_item = c.findNodes('[wlxml-class=list-items] > div')[0]; + assert.equal(alice_item.getContent(), 'alice'); + + c.listRemove({pointer: alice_item}); + + assertDomEqual(c.getContent(), utils.cleanUp('\ +
\ +
alice
\ +
cat
\ +
dog
\ +
bee
\ +
')); + + }); }); }); \ No newline at end of file