don't mix jQuery and '$', they can be different variables
[mkws-moved-to-github.git] / test / spec / jquery.spec.js
1 /* Copyright (c) 2013 IndexData ApS. http://indexdata.com
2  *
3  * jQuery test
4  *
5  */
6
7 describe("jQuery suite simple", function() {
8     var $ = require('jquery');
9
10     it("jQuery append test", function() {
11       $("body").append("<h1>test passes h1</h1>");
12       expect( $("body").html() ).toMatch(/<h1>/);
13       $("<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 });