save caret position when ending a list
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / canvas.test.js
index 0654170..028c767 100644 (file)
@@ -293,7 +293,11 @@ describe('Custom elements based on wlxml class attribute', function() {
                 onNodeAdded: function(event) {
                     void(event);
                     this.refresh2();
                 onNodeAdded: function(event) {
                     void(event);
                     this.refresh2();
-                }
+                },
+                onNodeTextChange: function(event) {
+                    this.header.text(event.meta.node.getText());
+                },
+                children: function() { return []; }
         });
 
         var c = getCanvasFromXML('<section><div class="testClass"><a></a></div></section>', [
         });
 
         var c = getCanvasFromXML('<section><div class="testClass"><a></a></div></section>', [
@@ -309,6 +313,14 @@ describe('Custom elements based on wlxml class attribute', function() {
         node.append({tagName: 'div'});
 
         expect(header.text()).to.equal('2', 'added div');
         node.append({tagName: 'div'});
 
         expect(header.text()).to.equal('2', 'added div');
+
+        var textNode = node.append({text: 'test'});
+
+        expect(header.text()).to.equal('3', 'added text node');
+        
+        textNode.setText('test2');
+
+        expect(header.text()).to.equal('test2', 'text node change handled');
     });
 
     describe('Handling unknown class', function() {
     });
 
     describe('Handling unknown class', function() {
@@ -477,7 +489,7 @@ describe('Cursor', function() {
         });
     });
 
         });
     });
 
-    it('returns boundries of selection when browser selection not collapsed', function() {
+    it('returns boundaries of selection when browser selection not collapsed', function() {
         var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
             dom = c.doc().dom,
             text = {
         var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
             dom = c.doc().dom,
             text = {
@@ -509,7 +521,7 @@ describe('Cursor', function() {
         });
     });
 
         });
     });
 
-    it('recognizes when browser selection boundries lies in sibling DocumentTextElements', function() {
+    it('recognizes when browser selection boundaries lies in sibling DocumentTextElements', function() {
         var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
             dom = c.doc().dom,
             text = {
         var c = getCanvasFromXML('<section>Alice <span>has</span> a <span>big</span> cat</section>'),
             dom = c.doc().dom,
             text = {