appending element node
[fnpeditor.git] / src / smartxml / smartxml.test.js
1 define([
2     'libs/chai',
3     './smartxml.js'
4 ], function(chai, smartxml) {
5     
6 'use strict';
7
8
9 var expect = chai.expect;
10
11
12 var getDocumentFromXML = function(xml) {
13     return smartxml.documentFromXML(xml);
14 }
15
16 var elementNodeFromParams = function(params) {
17     return smartxml.elementNodeFromXML('<' + params.tag + '></' + params.tag + '>');
18 }
19
20
21 describe.only('smartxml', function() {
22
23     describe('Basic use', function() {
24         it('exposes root element', function() {
25             var doc = getDocumentFromXML('<div></div>');
26             expect(doc.root.getTagName()).to.equal('div');
27         });
28     });
29
30     describe('Manipulations', function() {
31
32         it('appende element node to another element node', function() {
33             var node1 = elementNodeFromParams({tag: 'div'}),
34                 node2 = elementNodeFromParams({tag: 'a'});
35             node1.append(node2);
36             expect(node1.contents()[0].sameNode(node2)).to.be.true;
37         });
38
39     });
40
41 });
42
43 });