changing wlxml.WLXMLElementNode.getMEtaAttributes api
[fnpeditor.git] / src / wlxml / wlxml.test.js
1 define([
2     'libs/chai',
3     './wlxml.js'
4 ], function(chai, wlxml) {
5     
6 'use strict';
7
8 /* global it, describe */
9
10 var expect = chai.expect;
11
12 var nodeFromXML = function(xml) {
13     return wlxml.WLXMLElementNodeFromXML(xml);
14 };
15
16
17 describe('WLXMLDocument', function() {
18     
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');
23         });
24
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'}]);
28         });
29
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'});
33         });
34     });
35
36 });
37
38 });