From: Aleksander Ɓukasz Date: Thu, 3 Oct 2013 14:21:25 +0000 (+0200) Subject: Tests refactoring X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/81f3c62162311a0c697007389567e79aae9e597f Tests refactoring --- diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index 4af5e48..bdf7527 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -52,7 +52,11 @@ $.extend(WLXMLDocument.prototype, { return { WLXMLDocumentFromXML: function(xml) { return new WLXMLDocument(xml); - } + }, + + WLXMLElementNodeFromXML: function(xml) { + return this.WLXMLDocumentFromXML(xml).root; + } }; }); \ No newline at end of file diff --git a/src/wlxml/wlxml.test.js b/src/wlxml/wlxml.test.js index 95c230f..dd0bc11 100644 --- a/src/wlxml/wlxml.test.js +++ b/src/wlxml/wlxml.test.js @@ -7,11 +7,18 @@ define([ var expect = chai.expect; +var nodeFromXML = function(xml) { + return wlxml.WLXMLElementNodeFromXML(xml); +}; -describe('how it works', function() { - it('does something', function() { - var doc = wlxml.WLXMLDocumentFromXML('
'); - expect(doc.root.getClass()).to.equal('class.subclass'); + +describe('WLXMLDocument', function() { + + describe('Basic wlxml element node properties', function() { + it('returns its class', function() { + var node = nodeFromXML('
'); + expect(node.getClass()).to.equal('class.subclass'); + }); }); });