From 7f16806f51445cf3d5759a31e5752694cd9708c8 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 21 Aug 2013 14:41:25 +0200 Subject: [PATCH] a basic jquery test for jasmine --- test/spec/jquery.spec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/spec/jquery.spec.js diff --git a/test/spec/jquery.spec.js b/test/spec/jquery.spec.js new file mode 100644 index 0000000..1a59cf2 --- /dev/null +++ b/test/spec/jquery.spec.js @@ -0,0 +1,28 @@ +var $ = jQuery = require('jquery'); + +describe("jQuery suite", function() { + it("jQuery append test", function() { + jQuery("

test passes h1

").appendTo("body"); + expect( $("body").html() ).toMatch(/

/); + + jQuery("

this is a paragraph

").appendTo("h1"); + expect( $("body").html() ).toMatch(/this is a paragraph/); + }); + + it("$ append test", function() { + $("

test passes h2

").appendTo("body"); + expect( $("body").html() ).toMatch(/

/); + + $("

this is a second paragraph

").appendTo("h1"); + expect( $("body").html() ).toMatch(/this is a paragraph/); + }); + + it("more jquery tests", function() { + // other tests + expect( $("h2").html() ).toMatch(/test passes h2/); + expect( $("h1").html() ).toMatch(/test passes h1/); + expect( $("h1").html() ).not.toMatch(/^$/); + expect( $("h1").html() ).not.toMatch(/foobar/); + }); +}); + -- 1.7.10.4