expect($xmlOut.attr('a')).to.equal('1');
expect($xmlOut.attr('xmlns:dcterms')).to.equal('http://purl.org/dc/terms/');
+ });
+
+ it('doesn\' serialize meta attribute if its empty', function() {
+ var c;
+
+ c = canvas.fromXML('<section class="uri" meta-uri="some.uri"></section>');
+ c.doc().setWlxmlMetaAttr('uri', '');
+ expect($(c.toXML()).attr('meta-uri')).to.equal(undefined, 'overriding attribute with zero length string');
+ c = canvas.fromXML('<section class="uri"></section>');
+ c.doc().setWlxmlMetaAttr('uri', '');
+ expect($(c.toXML()).attr('meta-uri')).to.equal(undefined, 'setting attribute to zero length string');
});
describe('formatting output xml', function() {
node.attr('class', this.getWlxmlClass());
var meta = this.getWlxmlMetaAttrs();
meta.forEach(function(attr) {
- node.attr('meta-' + attr.name, attr.value);
+ if(attr.value)
+ node.attr('meta-' + attr.name, attr.value);
});
_.keys(this.data('other-attrs') || {}).forEach(function(key) {
node.attr(key, this.data('other-attrs')[key]);