Fix: publishing the right element as current text element on selecting node element
[fnpeditor.git] / modules / documentCanvas / canvas / canvas.test3.js
index 705ef2c..43c9083 100644 (file)
@@ -304,7 +304,7 @@ describe('Canvas', function() {
                         children = c.doc().children();
 
                     expect(children.length).to.equal(1);
-                    expect(children[0].sameNode(appended));
+                    expect(children[0].sameNode(appended)).to.be.true;
                 });
 
                 it('can put new TextElement at the end', function() {
@@ -313,7 +313,7 @@ describe('Canvas', function() {
                         children = c.doc().children();
 
                     expect(children.length).to.equal(1);
-                    expect(children[0].sameNode(appended));
+                    expect(children[0].sameNode(appended)).to.be.true;
                     expect(children[0].getText()).to.equal('Alice');
                 });
 
@@ -323,7 +323,7 @@ describe('Canvas', function() {
                         added = div.after({tag: 'header', klass: 'some.class'}),
                         children = c.doc().children();
                     expect(children.length).to.equal(2);
-                    expect(children[1].sameNode(added));
+                    expect(children[1].sameNode(added)).to.be.true;
                 });
 
                 it('can put new Nodeelement before another element', function() {
@@ -332,7 +332,7 @@ describe('Canvas', function() {
                         added = div.before({tag: 'header', klass: 'some.class'}),
                         children = c.doc().children();
                     expect(children.length).to.equal(2);
-                    expect(children[0].sameNode(added));
+                    expect(children[0].sameNode(added)).to.be.true;
                 });
 
                 it('can put new DocumentNodeElement after DocumentTextElement', function() {
@@ -368,7 +368,7 @@ describe('Canvas', function() {
                         section = c.doc(),
                         text = section.children()[0].children()[0];
 
-                    text.split({offset: 5});
+                    var returnedValue = text.split({offset: 5});
                     expect(section.children().length).to.equal(2, 'section has two children');
                     
                     var header1 = section.children()[0];
@@ -380,6 +380,9 @@ describe('Canvas', function() {
                     expect(header2.getWlxmlTag()).to.equal('header', 'second section child represents wlxml header');
                     expect(header2.children().length).to.equal(1, 'second header has one text child');
                     expect(header2.children()[0].getText()).to.equal('header', 'second header has correct content');
+
+                    expect(returnedValue.first.sameNode(header1)).to.equal(true, 'first node returnde');
+                    expect(returnedValue.second.sameNode(header2)).to.equal(true, 'second node returned');
                 });
 
                 it('leaves empty copy of DocumentNodeElement if splitting at the very beginning', function() {