documentation
[mkws-moved-to-github.git] / test / spec / jquery.spec.js
1 /*
2  * jQuery test for node.js
3  *
4  */
5
6 var $ = jQuery = require('jquery');
7
8 describe("jQuery suite", function() {
9   it("jQuery append test", function() {
10     jQuery("<h1>test passes h1</h1>").appendTo("body");
11     expect( $("body").html() ).toMatch(/<h1>/);
12
13     jQuery("<p>this is a paragraph</p>").appendTo("h1");
14     expect( $("body").html() ).toMatch(/this is a paragraph/);
15   });
16
17   it("$ append test", function() {
18     $("<h2>test passes h2</h2>").appendTo("body");
19     expect( $("body").html() ).toMatch(/<h2>/);
20
21     $("<p>this is a second paragraph</p>").appendTo("h1");
22     expect( $("body").html() ).toMatch(/this is a paragraph/);
23   });
24
25   it("more jquery tests", function() {
26     // other tests
27     expect( $("h2").html() ).toMatch(/test passes h2/);
28     expect( $("h1").html() ).toMatch(/test passes h1/);
29     expect( $("h1").html() ).not.toMatch(/^$/);
30     expect( $("h1").html() ).not.toMatch(/foobar/);
31   });
32 });
33