From 55214bb5f3c1770b8ac68766adc1dbb7db106450 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 21 Aug 2013 15:17:05 +0200 Subject: [PATCH] jQuery test with DOM/windows object --- test/spec/jsdom.spec.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/spec/jsdom.spec.js 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(); + }); +}); -- 1.7.10.4