X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0f406b246f9261651b5982be71a49189349c8e3e..b554451bd332b417a9304fd60fafe116220a9ca4:/modules/documentCanvas/tests/canvas.test.js?ds=sidebyside
diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js
index 386e375..57ad625 100644
--- a/modules/documentCanvas/tests/canvas.test.js
+++ b/modules/documentCanvas/tests/canvas.test.js
@@ -54,6 +54,20 @@ define([
assert.equal(header.tag, 'header');
assert.equal(header.klass, 'some-class');
});
+
+ test('getting previous node', function() {
+ var c = new canvas.Canvas('');
+ var secondDiv = c.getNode({tag: 'div'})[1];
+ var firstDiv = c.getPreviousNode({node: secondDiv});
+ assert.equal(firstDiv.klass, 'some-class');
+ })
+
+ test('pervious node of node without "previous siblings" is its parent', function() {
+ var c = new canvas.Canvas('');
+ var div = c.getNode({tag: 'div'})[0];
+ var section = c.getPreviousNode({node: div});
+ assert.equal(section.tag, 'section');
+ })
test('inserting after', function() {
var c = new canvas.Canvas('');
@@ -81,6 +95,29 @@ define([
);
});
+ test('split node with subnodes', function() {
+ var c = new canvas.Canvas('');
+ var header = c.getNode({tag: 'header'})[0];
+ c.splitNode({node: header, textNodeIdx: 0, offset: 5});
+ assert.xmlEqual(c.toXML(), '\
+ '
+ );
+ });
+
+ test('remove node', function() {
+ var c = new canvas.Canvas('');
+ var span = c.getNode({tag: 'span'})[0];
+ var siblings = c.removeNode({node:span});
+ assert.xmlEqual(c.toXML(), '\
+ '
+ );
+ });
+
test('list', function() {
var c = new canvas.Canvas('');
var div1 = c.getNode({tag:'div'})[0];
@@ -96,7 +133,7 @@ define([
a cat
\
\
');
-
+
});
});