public
Description: Johnson wraps JavaScript in a loving Ruby embrace.
Homepage: http://github.com/jbarnette/johnson/wikis
Clone URL: git://github.com/jbarnette/johnson.git
It's not over till it's over br0.
wycats (author)
Sat May 31 17:46:16 -0700 2008
commit  8f379af3241e2b6cb791eec868d41be20d736255
tree    a48c9430cfee04b85259f18aa99f14325d40befe
parent  d7e38f0a1a1e777ca2370838fc6a7f8dc0b05b92
...
156
157
158
 
159
160
161
...
156
157
158
159
160
161
162
0
@@ -156,6 +156,7 @@ print = function(txt) { Ruby.puts(txt); };
0
       return makeNode( this._dom.createElement(name.toLowerCase()) );
0
     },
0
     getElementsByTagName: function(name){
0
+      Ruby.puts(this._dom);
0
       return new DOMNodeList( this._dom.getElementsByTagName(
0
         name.toLowerCase()) );
0
     },
...
2
3
4
5
 
6
7
8
...
174
175
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
178
...
2
3
4
 
5
6
7
8
...
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
0
@@ -2,7 +2,7 @@ console = {
0
   indentation: 0,
0
   indent: function() {
0
     for(i=0;i<this.indentation - 1;i++) Ruby.print("  ");
0
-    if(this.indentation > 0) Ruby.print("- ")
0
+    if(this.indentation > 0) Ruby.print("- ");
0
   },
0
   group: function(msg) {
0
     this.info(msg);
0
@@ -174,4 +174,19 @@ jspec.matchers["be_instanceof"] = {
0
       "to be an instance of " + jspec.print_object(target) + ", but was " + 
0
       jspec.print_object(target.constructor);
0
   }
0
+}
0
+
0
+jspec.matchers["have_constructor"] = {
0
+  describe: function(self, target, not) {
0
+    return jspec.print_object(self) + " should " + (not ? "not " : "") + 
0
+      "have " + jspec.print_object(target) + " as its constructor";
0
+  },
0
+  matches: function(self, target) {
0
+    return self instanceof target;
0
+  },
0
+  failure_message: function(self, target, not) {
0
+    return "Expected " + jspec.print_object(self) + (not ? "not " : "") + 
0
+      "to have " + jspec.print_object(target) + ", as its constructor but was " + 
0
+      jspec.print_object(target.constructor);
0
+  }
0
 }
0
\ No newline at end of file
...
7
8
9
10
11
 
 
 
 
 
12
13
14
 
 
 
15
...
7
8
9
 
 
10
11
12
13
14
15
 
16
17
18
19
20
0
@@ -7,7 +7,12 @@ jspec.describe("awesomeness", function() {
0
     window.location = fileLocation;
0
     Johnson.waitForThreads();
0
     expect(window.location).to("==", uriLocation);
0
-    expect(document).to("be_instanceof", DOMDocument);
0
-    expect(document.childNodes).to("be_instanceof", Array);
0
+    expect(document).to("have_constructor", DOMDocument);
0
+    document.body;
0
+    document.body;
0
+    document.body;
0
+    // expect(document.body).to("have_constructor", DOMNode);
0
   });
0
-});
0
\ No newline at end of file
0
+});
0
+
0
+;
0
\ No newline at end of file

Comments