From 81f3c62162311a0c697007389567e79aae9e597f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 3 Oct 2013 16:21:25 +0200 Subject: [PATCH 1/1] Tests refactoring --- src/wlxml/wlxml.js | 6 +++++- src/wlxml/wlxml.test.js | 15 +++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) 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'); + }); }); }); -- 2.20.1