c83809a49249f8d0641fcd166bc131df48623295
[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 describe("jQuery suite", function () {
8     var jsdom = require('jsdom').jsdom;
9     var myWindow = jsdom().createWindow();
10
11     var $ = require('jQuery');
12     var jq = require('jQuery').create();
13     var jQuery = require('jQuery').create(myWindow);
14
15     it("jQuery append test", function () {
16         jQuery("<h1>test passes h1</h1>").appendTo("body");
17         expect(jQuery("body").html()).toMatch(/<h1>/);
18     });
19
20     it("$ append test", function () {
21         $("<h2>test passes h2</h2>").appendTo("body");
22         expect($("body").html()).toMatch(/<h2>/);
23     });
24
25     it("jq append test", function () {
26         jq("<h2>test passes h2</h2>").appendTo("body");
27         expect(jq("body").html()).toMatch(/<h2>/);
28     });
29
30     it("window test", function () {
31         expect(myWindow).toBeDefined();
32     });
33 });