Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 100 lines (80 sloc) 2.837 kb
faaae412 »
2008-01-13 Initial checkin
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3
4 <html lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 <title>tester</title>
8 <meta name="generator" content="TextMate http://macromates.com/">
9 <meta name="author" content="Yehuda Katz">
10 <script src="jspec.js"></script>
11 <script>$ = "$"</script>
12 <script src="jquery.js"></script>
13 <script>
14 jspec.describe("The browser environment", function() {
15 it("should have Array.prototype.push", function() {
16 Array.prototype.push.should("exist");
17 });
18
19 it("should have Function.prototype.apply", function() {
20 Function.prototype.apply.should("exist");
21 });
22
23 it("should have document.getElementById", function() {
24 document.getElementById.should("exist");
25 });
26
27 it("should have document.getElementsByTagName", function() {
28 document.getElementsByTagName.should("exist");
29 });
30
31 it("should have RegExp", function() {
32 RegExp.should("exist");
33 });
34
35 it("should have jQuery", function() {
36 jQuery.should("exist");
37 });
38 })
39
40 jspec.describe("$()", function() {
41 it("should generate the correct number of elements for <code>", function() {
42 $("<code/>").length.should("==", 1);
43 });
44
45 it("should generate the correct number of elements for <img>", function() {
46 $("<img/>").length.should("==", 1);
47 });
48
49 it("should generate the correct number of elements for <div/><hr/><code/><b/>", function() {
50 $("<div/><hr/><code/><b/>").length.should("==", 4);
51 });
52 })
53
54 jspec.describe("jQuery.noConflict()", function() {
55 var old = jQuery;
56 var newjQuery = jQuery.noConflict();
57
58 it("should return the jQuery object", function() {
59 newjQuery.should("==", old);
60 });
61
62 it("should not have harmed the original jQuery", function() {
63 jQuery.should("==", old)
64 });
65
66 it("should revert $", function() {
67 $.should("==", "$");
68 });
69
70 jQuery = $ = old;
71 newjQuery = jQuery.noConflict(true);
72
73
74 })
75
76 // var old = jQuery;
77 // var newjQuery = jQuery.noConflict();
78 //
79 // ok( newjQuery == old, "noConflict returned the jQuery object" );
80 // ok( jQuery == old, "Make sure jQuery wasn't touched." );
81 // ok( $ == "$", "Make sure $ was reverted." );
82 //
83 // jQuery = $ = old;
84 //
85 // newjQuery = jQuery.noConflict(true);
86 //
87 // ok( newjQuery == old, "noConflict returned the jQuery object" );
88 // ok( jQuery == "jQuery", "Make sure jQuery was reverted." );
89 // ok( $ == "$", "Make sure $ was reverted." );
90 //
91 // jQuery = $ = old;
92
93
94 </script>
95 <!-- Date: 2007-10-28 -->
96 </head>
97 <body>
98
99 </body>
100 </html>
Something went wrong with that request. Please try again.