From: Wolfram Schneider Date: Wed, 21 Aug 2013 13:17:05 +0000 (+0200) Subject: jQuery test with DOM/windows object X-Git-Tag: 0.9.1~202^2~106 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=55214bb5f3c1770b8ac68766adc1dbb7db106450;p=mkws-moved-to-github.git jQuery test with DOM/windows object --- diff --git a/test/spec/jsdom.spec.js b/test/spec/jsdom.spec.js new file mode 100644 index 0000000..77f6770 --- /dev/null +++ b/test/spec/jsdom.spec.js @@ -0,0 +1,35 @@ +/* Copyright (c) 2013 IndexData ApS. http://indexdata.com + * + * jQuery test with DOM/windows object + * + */ + +var jsdom = require('jsdom').jsdom; +var myWindow = jsdom().createWindow(); +var $ = require('jquery'); +var jq = require('jquery').create(); +var jQuery = require('jquery').create(myWindow); + +describe("jQuery suite", function() { + it("jQuery append test", function() { + jQuery("

test passes h1

").appendTo("body"); + expect( jQuery("body").html() ).toMatch(/

/); + }); + + it("$ append test", function() { + $("

test passes h2

").appendTo("body"); + expect( $("body").html() ).toMatch(/

/); + }); + + it("jq append test", function() { + jq("

test passes h2

").appendTo("body"); + expect( jq("body").html() ).toMatch(/

/); + }); + +}); + +describe("jsdom suite", function() { + it("window test", function() { + expect(myWindow).toBeDefined(); + }); +});