4 ], function(chai, wlxml) {
8 /* global it, describe */
10 var expect = chai.expect;
12 var nodeFromXML = function(xml) {
13 return wlxml.WLXMLElementNodeFromXML(xml);
17 describe('WLXMLDocument', function() {
19 describe('Basic wlxml element node properties', function() {
20 it('returns its class', function() {
21 var node = nodeFromXML('<header class="class.subclass"></header>');
22 expect(node.getClass()).to.equal('class.subclass');
25 it('returns its attributes as dict', function() {
26 var node = nodeFromXML('<span meta-attr1="val1" meta-attr2="val2"></span>');
27 expect(node.getMetaAttributes()).to.eql([{name: 'attr1', value: 'val1'}, {name: 'attr2', value: 'val2'}]);
30 it('returns attributes other than class and meta-* as other attributes', function() {
31 var node = nodeFromXML('<span class="uri" meta-attr="val" attr1="val1" attr2="val2"></span>');
32 expect(node.getOtherAttributes()).to.eql({attr1: 'val1', attr2: 'val2'});