- var node = canvasNode.create({tag: 'tag', meta: {a:'1'}});
- node.setMetaAttr('a', '2');
- assert.equal(node.dom.attr('wlxml-meta-a'), '2');
+ var node = canvasNode.create({tag: 'tag', klass: 'uri', meta: {'uri': 'some uri'}});
+ node.setMetaAttr('uri', 'some uri 2');
+ assert.equal(node.dom.attr('wlxml-meta-uri'), 'some uri 2');
+ });
+
+ test('changing class changes meta attributes', function() {
+ var node = canvasNode.create({tag: 'span', klass: 'uri', meta: {uri: 'http://some.uri.com'}});
+
+ assert.equal(node.getMetaAttr('uri'), 'http://some.uri.com');
+
+ node.setClass('author');
+
+ assert.equal(node.getMetaAttr('uri'), undefined);
+ });
+
+ test('changing class to another with the same attribute keeps the value', function() {
+ var node = canvasNode.create({tag: 'span', klass: 'uri', meta: {uri: 'http://some.uri.com'}});
+ assert.equal(node.getMetaAttr('uri'), 'http://some.uri.com');
+ node.setClass('uri-subclass');
+ assert.equal(node.getMetaAttr('uri'), 'http://some.uri.com');