jQuery test with DOM/windows object
[mkws-moved-to-github.git] / test / spec / jsdom.spec.js
1 /* Copyright (c) 2013 IndexData ApS. http://indexdata.com
2  *
3  * jQuery test with DOM/windows object
4  *
5  */
6
7 var jsdom = require('jsdom').jsdom;
8 var myWindow = jsdom().createWindow();
9 var $ = require('jquery');
10 var jq = require('jquery').create();
11 var jQuery = require('jquery').create(myWindow);
12
13 describe("jQuery suite", function() {
14   it("jQuery append test", function() {
15     jQuery("<h1>test passes h1</h1>").appendTo("body");
16     expect( jQuery("body").html() ).toMatch(/<h1>/);
17   });
18
19   it("$ append test", function() {
20     $("<h2>test passes h2</h2>").appendTo("body");
21     expect( $("body").html() ).toMatch(/<h2>/);
22   });
23
24   it("jq append test", function() {
25     jq("<h2>test passes h2</h2>").appendTo("body");
26     expect( jq("body").html() ).toMatch(/<h2>/);
27   });
28
29 });
30
31 describe("jsdom suite", function() {
32   it("window test", function() {
33     expect(myWindow).toBeDefined();
34   });
35 });