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