X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/6a770096a6f30ae819ec07c74e513770130f2721..bb2c206bdd17b1f42cfdcdd62b105873a1b8f9a2:/src/smartxml/smartxml.test.js?ds=sidebyside diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index c4f99e8..35cca61 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -9,11 +9,35 @@ define([ var expect = chai.expect; -describe.only('Basic use', function() { - it('exposes root element', function() { - var doc = smartxml.fromXML('
'); - expect(doc.root.getTagName()).to.equal('div'); +var getDocumentFromXML = function(xml) { + return smartxml.documentFromXML(xml); +} + +var elementNodeFromParams = function(params) { + return smartxml.elementNodeFromXML('<' + params.tag + '>'); +} + + +describe.only('smartxml', function() { + + describe('Basic use', function() { + it('exposes root element', function() { + var doc = getDocumentFromXML('
'); + expect(doc.root.getTagName()).to.equal('div'); + }); }); + + describe('Manipulations', function() { + + it('appende element node to another element node', function() { + var node1 = elementNodeFromParams({tag: 'div'}), + node2 = elementNodeFromParams({tag: 'a'}); + node1.append(node2); + expect(node1.contents()[0].sameNode(node2)).to.be.true; + }); + + }); + }); }); \ No newline at end of file