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>', [
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() {
this.dom.contents()[0].data = text;
}
},
+ handle: function(event) {
+ this.setText(event.meta.node.getText());
+ },
getText: function(options) {
options = _.extend({raw: false}, options || {});
var toret = this.dom.text();
},
nodeTextChange: function(event) {
var element = utils.getElementForNode(event.meta.node);
- element.setText(event.meta.node.getText());
+ element.handle(event);
},
metadataChanged: _metadataEventHandler,