X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a398f2a96740ebe6dd60559d90e74c648e7009af..75e7ee4a984c04ac54d14f7ac56be71130c9a1d3:/modules/documentCanvas/tests/canvas.test.js?ds=inline
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('');
+ var span = c.findNodes({tag:'span'})[0];
+ c.nodeUnwrap({node: span});
+ assertDomEqual(c.getContent(), '');
+ });
test('split node', function() {
var c = canvas.create('');
@@ -260,6 +289,38 @@ define([
'));
+ });
+
+ test('removing list containing nested list', function() {
+ var nestedList = utils.cleanUp('\
+ ');
+
+ 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