4edf683b493a6b7d79900ccb6d77586d78a0dd8b
[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 });