X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/cb97894506c25210fd9267397023c3adfb312a2c..6ec6461eaba0dfa50a065dac18eb7cc6455cb827:/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('');
+ var span = c.findNodes({tag:'span'})[0];
+ c.nodeUnwrap({node: span});
+ assertDomEqual(c.getContent(), '');
+ });
test('split node', function() {
var c = canvas.create('');