@@ -6,6 +6,8 @@ var http = require("http");
6
6
var fs = require ( "fs" ) ;
7
7
var toFileUrl = require ( "../util" ) . toFileUrl ( __dirname ) ;
8
8
9
+ var serializeDocument = require ( '../../lib/jsdom' ) . serializeDocument ;
10
+
9
11
exports [ "with invalid arguments" ] = function ( t ) {
10
12
t . throws ( function ( ) { jsdom . env ( ) ; } ) ;
11
13
t . throws ( function ( ) { jsdom . env ( { } ) ; } ) ;
@@ -20,7 +22,7 @@ exports["explicit config.html, full document"] = function (t) {
20
22
url : "http://example.com/" ,
21
23
done : function ( err , window ) {
22
24
t . ifError ( err ) ;
23
- t . equal ( window . document . innerHTML , "<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>" ) ;
25
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>" ) ;
24
26
t . equal ( window . location . href , "http://example.com/" ) ;
25
27
t . equal ( window . location . origin , "http://example.com" ) ;
26
28
t . done ( ) ;
@@ -34,7 +36,7 @@ exports["explicit config.html, with overriden config.url"] = function (t) {
34
36
url : "http://example.com/" ,
35
37
done : function ( err , window ) {
36
38
t . ifError ( err ) ;
37
- t . equal ( window . document . innerHTML , "<html><head></head><body>Hello</body></html>" ) ;
39
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<html><head></head><body>Hello</body></html>" ) ;
38
40
t . equal ( window . location . href , "http://example.com/" ) ;
39
41
t . equal ( window . location . origin , "http://example.com" ) ;
40
42
t . equal ( window . location . search , "" ) ;
@@ -97,7 +99,7 @@ exports["explicit config.html, a string that is also a valid URL"] = function (t
97
99
url : "http://example.com/" ,
98
100
done : function ( err , window ) {
99
101
t . ifError ( err ) ;
100
- t . equal ( window . document . innerHTML , "<html><head></head><body>http://example.com/</body></html>" ) ;
102
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<html><head></head><body>http://example.com/</body></html>" ) ;
101
103
t . equal ( window . location . href , "http://example.com/" ) ;
102
104
t . done ( ) ;
103
105
}
@@ -111,7 +113,7 @@ exports["explicit config.html, a string that is also a valid file"] = function (
111
113
url : "http://example.com/" ,
112
114
done : function ( err , window ) {
113
115
t . ifError ( err ) ;
114
- t . equal ( window . document . innerHTML , "<html><head></head><body>" + body + "</body></html>" ) ;
116
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<html><head></head><body>" + body + "</body></html>" ) ;
115
117
t . equal ( window . location . href , "http://example.com/" ) ;
116
118
t . done ( ) ;
117
119
}
@@ -132,7 +134,7 @@ exports["explicit config.url, valid"] = function (t) {
132
134
url : "http://localhost:8976/" ,
133
135
done : function ( err , window ) {
134
136
t . ifError ( err ) ;
135
- t . equal ( window . document . innerHTML , responseText ) ;
137
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , responseText ) ;
136
138
t . equal ( window . location . href , "http://localhost:8976/" ) ;
137
139
t . equal ( window . location . origin , "http://localhost:8976" ) ;
138
140
t . done ( ) ;
@@ -158,7 +160,7 @@ exports["explicit config.file, valid"] = function (t) {
158
160
file : fileName ,
159
161
done : function ( err , window ) {
160
162
t . ifError ( err ) ;
161
- t . equal ( window . document . innerHTML , '<!DOCTYPE html><html><head>\n\
163
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , '<!DOCTYPE html><html><head>\n\
162
164
<title>hello, Node.js!</title>\n\
163
165
</head>\n\
164
166
<body>\n\
@@ -226,7 +228,7 @@ exports["string, parseable as a URL, valid"] = function (t) {
226
228
"http://localhost:8976/" ,
227
229
function ( err , window ) {
228
230
t . ifError ( err ) ;
229
- t . equal ( window . document . innerHTML , responseText ) ;
231
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , responseText ) ;
230
232
t . equal ( window . location . href , "http://localhost:8976/" ) ;
231
233
t . equal ( window . location . origin , "http://localhost:8976" ) ;
232
234
t . done ( ) ;
@@ -252,7 +254,7 @@ exports["string, for an existing filename"] = function (t) {
252
254
fileName ,
253
255
function ( err , window ) {
254
256
t . ifError ( err ) ;
255
- t . equal ( window . document . innerHTML , '<!DOCTYPE html><html><head>\n\
257
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , '<!DOCTYPE html><html><head>\n\
256
258
<title>hello, Node.js!</title>\n\
257
259
</head>\n\
258
260
<body>\n\
@@ -272,7 +274,7 @@ exports["string, does not exist as a file"] = function (t) {
272
274
body ,
273
275
function ( err , window ) {
274
276
t . ifError ( err ) ;
275
- t . equal ( window . document . innerHTML , "<html><head></head><body>" + body + "</body></html>" ) ;
277
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<html><head></head><body>" + body + "</body></html>" ) ;
276
278
t . done ( ) ;
277
279
}
278
280
) ;
@@ -283,7 +285,7 @@ exports["string, full HTML document"] = function (t) {
283
285
"<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>" ,
284
286
function ( err , window ) {
285
287
t . ifError ( err ) ;
286
- t . equal ( window . document . innerHTML , "<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>" ) ;
288
+ t . equal ( serializeDocument ( window . document , { omitDoctype : true } ) , "<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>" ) ;
287
289
t . done ( ) ;
288
290
}
289
291
) ;
0 commit comments