});
it('knows WLXML class of a WLXML tag it renders', function(){
- var c = canvas.fromXML('<section class="some.class"></section>'),
+ var c = canvas.fromXML('<section class="some.class.A"></section>'),
section = c.doc();
- expect(section.getWlxmlClass()).to.equal('some.class');
- section.setWlxmlClass('some.other.class');
- expect(section.getWlxmlClass()).to.equal('some.other.class');
+ expect(section.getWlxmlClass()).to.equal('some.class.A');
+ section.setWlxmlClass('some.class.B');
+ expect(section.getWlxmlClass()).to.equal('some.class.B');
section.setWlxmlClass(null);
expect(section.getWlxmlClass()).to.be.undefined;
});
getWlxmlClass: function() {
var klass = this.dom().attr('wlxml-class');
if(klass)
- return klass.replace('-', '.');
+ return klass.replace(/-/g, '.');
return undefined;
},
setWlxmlClass: function(klass) {
if(klass)
- this.dom().attr('wlxml-class', klass.replace('.', '-'));
+ this.dom().attr('wlxml-class', klass.replace(/\./g, '-'));
else
this.dom().removeAttr('wlxml-class');
},
view.on('change', 'select', function(e) {
var target = $(e.target);
var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class';
- sandbox.publish('nodeElementChange', attr, target.val());
+ sandbox.publish('nodeElementChange', attr, target.val().replace(/-/g, '.'));
});
return {
},
setNodeElement: function(nodeElement) {
view.find('.rng-module-nodePane-tagSelect').val(nodeElement.getWlxmlTag());
- view.find('.rng-module-nodePane-classSelect').val(nodeElement.getWlxmlClass());
+ view.find('.rng-module-nodePane-classSelect').val((nodeElement.getWlxmlClass() || '').replace(/\./g, '-'));
//var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()});
//widget.on('valueChanged', function(key, value) {