1 describe("jsdom/jQuery suite simple", function () {
2 it("jsdom test", function () {
3 var jsdom = require("jsdom");
4 var DOMParser = require('xmldom').DOMParser;
10 url: "http://mkws-dev.indexdata.com/jasmine-local-popup.html",
13 FetchExternalResources: ["script"]
16 done: function (errors, window) {
17 var DOMParser = require('xmldom').DOMParser;
22 $(window).ready(function () {
23 console.log("document ready event");
24 console.log("mkws: " + window.mkws_config.pazpar2_url);
26 // setTimeout( function () { console.log("timeer...") }, 1000);
29 // spyOn(window, 'alert').andCallFake(function(msg) { console.log("fake allert: " + msg); });
30 window.alert = console.log;
31 window.console = console;
33 console.log("window.DOMParser: " + window.DOMParser);
34 console.log("window.document: " + window.document);
37 var xmlstring = "<rss version='2.0' jsessionId='CD8AFDD3040A81CFFDDD4EC066497139'><channel><title>RSS Title</title></channel></rss>";
38 $.parseXML = function (data) {
39 return new DOMParser().parseFromString(data)
41 console.log("parseXML: " + $.parseXML(xmlstring).documentElement.getAttribute('jsessionId'));
45 waitsFor(function () {
48 } else if (w && !w.mkws) {
54 return w && w.mkws && w.mkws.authenticated;
55 }, "window object done", 2 * 1000);
58 console.log("got window");
59 console.log("got mkws auth: " + w.mkws.authenticated);
60 console.log("window.DOMParser: " + w.$.parseXML);
61 // console.log("W: " + $("html").text() );
62 expect(w).toBeDefined();
65 waitsFor(function () {
67 return w.mkws.jasmine_done;
68 }, "jasmine test done", 3 * 1000);
71 console.log("jasmine test done: " + w.mkws.jasmine_done);
72 expect(w.mkws.jasmine_done).toBeTruthy();
76 it("jsdom test2", function () {
77 // expect($).toBeDefined();
85 jsdom.defaultDocumentFeatures = {
86 FetchExternalResources : ['script'],
87 ProcessExternalResources : ['script'],
88 MutationEvents : false,