indent
authorWolfram Schneider <wosch@indexdata.dk>
Thu, 30 Jan 2014 13:59:55 +0000 (13:59 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Thu, 30 Jan 2014 13:59:55 +0000 (13:59 +0000)
test/spec-dev/parseXML.js
test/spec-dev/parseXML.spec.js
test/spec-sp/mkws-index-jsdom.spec.js
test/spec/mkws-pazpar2.js

index 16c49fd..8c6a32f 100644 (file)
@@ -1,25 +1,25 @@
 // Workaround for broken XML parser in node.js/jquery
 // see https://github.com/coolaj86/node-jquery/issues/29
-
 var jsdom = require("jsdom");
 var DOMParser = require('xmldom').DOMParser;
-var xmlstring = '<?xml version="1.0" encoding="UTF-8"?><process>yes</process>'; 
+var xmlstring = '<?xml version="1.0" encoding="UTF-8"?><process>yes</process>';
+
+jsdom.env('<html/>',
+// ["http://code.jquery.com/jquery.js"],
 
-jsdom.env(
-  '<html/>',
-  // ["http://code.jquery.com/jquery.js"],
-  function (errors, window) {
-       // var $ = window.$; 
-        var $ = require('jQuery');
 
-       // override jquery xml parser with external XML lib xmldoc.DOMParser
-       $.parseXML = function(data) { return new DOMParser().parseFromString(data) };;
+function (errors, window) {
+    // var $ = window.$; 
+    var $ = require('jQuery');
 
-       // parse XML string, extract "process" node and keep the text value of the node
-       var result = $( $.parseXML(xmlstring)).find("process").text();
+    // override jquery xml parser with external XML lib xmldoc.DOMParser
+    $.parseXML = function (data) {
+        return new DOMParser().parseFromString(data)
+    };;
 
-       // should output "yes"
-       console.log("Testing jsdom/xmldom/jQuery $.parseXML() support: " + result);
-  }
-);
+    // parse XML string, extract "process" node and keep the text value of the node
+    var result = $($.parseXML(xmlstring)).find("process").text();
 
+    // should output "yes"
+    console.log("Testing jsdom/xmldom/jQuery $.parseXML() support: " + result);
+});
index 40483e0..6827642 100644 (file)
@@ -1,22 +1,22 @@
-describe("jsdom/jQuery suite simple", function() {
-    it("jsdom test", function() {
+describe("jsdom/jQuery suite simple", function () {
+    it("jsdom test", function () {
         var jsdom = require("jsdom");
 
-       var $, w;
-        jsdom.env('<p><a class="the-link" href="http://indexdata.com">jsdom\'s Homepage</a></p>', ["http://code.jquery.com/jquery.js"], function(errors, window) {
+        var $, w;
+        jsdom.env('<p><a class="the-link" href="http://indexdata.com">jsdom\'s Homepage</a></p>', ["http://code.jquery.com/jquery.js"], function (errors, window) {
             console.log("contents of a.the-link:", window.$("a.the-link").text());
-           w = window;
+            w = window;
             $ = window.$;
         });
 
-        waitsFor(function() {
+        waitsFor(function () {
             if (!w) {
-              console.log(".");
-            } 
+                console.log(".");
+            }
             return w;
         }, "window object done", 2 * 1000);
 
-        runs(function() {
+        runs(function () {
             console.log("got window");
             expect(w).toBeDefined();
             expect(w.document).toBeDefined();
@@ -24,20 +24,22 @@ describe("jsdom/jQuery suite simple", function() {
 
             var xmlstring = "<rss version='2.0' jsessionId='CD8AFDD3040A81CFFDDD4EC066497139'><channel><title>RSS Title</title></channel></rss>";
 
-           var DOMParser = require('xmldom').DOMParser;
-           var doc = new DOMParser().parseFromString(xmlstring);
-           console.log("doc: " + doc.documentElement.getAttribute('jsessionId'));
+            var DOMParser = require('xmldom').DOMParser;
+            var doc = new DOMParser().parseFromString(xmlstring);
+            console.log("doc: " + doc.documentElement.getAttribute('jsessionId'));
 
             var xmlDoc = doc; // $.parseXML(xml);
-                var xml = $(xmlDoc);
-                var title = xml.find("title");
+            var xml = $(xmlDoc);
+            var title = xml.find("title");
 
-            console.log("title: " + $(title).text() );
-           $.parseXML = function (data) { return new DOMParser().parseFromString(data) };;
+            console.log("title: " + $(title).text());
+            $.parseXML = function (data) {
+                return new DOMParser().parseFromString(data)
+            };;
 
-           console.log("parseXML: " + $( $.parseXML( xmlstring)).text() );
+            console.log("parseXML: " + $($.parseXML(xmlstring)).text());
 
-           // console.log(w.document);
+            // console.log(w.document);
         })
     });
 
index ea22425..fe0dbdf 100644 (file)
@@ -53,4 +53,3 @@ function jsdom_check(file, tags_array, ignore_doctype) {
 jsdom_check('../examples/htdocs/language.html', [utils.tags.required, utils.tags.optional, utils.tags.optional2]);
 jsdom_check('../examples/htdocs/mobile.html', [utils.tags.required, utils.tags.optional]);
 jsdom_check('../examples/htdocs/index.html', [utils.tags.required, utils.tags.optional]);
-
index dd7a2ab..d0bf9e8 100644 (file)
@@ -392,4 +392,3 @@ describe("All tests are done", function () {
         mkws.jasmine_done = true;
     });
 });
-