1 xdescribe("jsdom/jQuery suite simple", function () {
2 it("jsdom test", function () {
3 var jsdom = require("jsdom");
6 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) {
7 console.log("contents of a.the-link:", window.$("a.the-link").text());
12 waitsFor(function () {
17 }, "window object done", 2 * 1000);
20 console.log("got window");
21 expect(w).toBeDefined();
22 expect(w.document).toBeDefined();
23 expect($.parseXML).toBeDefined();
25 var xmlstring = "<rss version='2.0' jsessionId='CD8AFDD3040A81CFFDDD4EC066497139'><channel><title>RSS Title</title></channel></rss>";
27 var DOMParser = require('xmldom').DOMParser;
28 var doc = new DOMParser().parseFromString(xmlstring);
29 console.log("doc: " + doc.documentElement.getAttribute('jsessionId'));
31 var xmlDoc = doc; // $.parseXML(xml);
33 var title = xml.find("title");
35 console.log("title: " + $(title).text());
36 $.parseXML = function (data) {
37 return new DOMParser().parseFromString(data)
40 console.log("parseXML: " + $($.parseXML(xmlstring)).text());
42 // console.log(w.document);