Skip to content

Commit

Permalink
Merge pull request #527 from TomNomNom/master
Browse files Browse the repository at this point in the history
Fixed bug where script passed to jsdom.env contains spaces
  • Loading branch information
domenic committed Nov 5, 2012
2 parents d047be8 + da450d4 commit 40f0eb5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jsdom/level2/html.js
Expand Up @@ -143,7 +143,7 @@ core.resourceLoader = {
request.end();
},
readFile: function(url, callback) {
fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/'), 'utf8', callback);
fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/').replace(/%20/g, ' '), 'utf8', callback);
}
};

Expand Down
11 changes: 11 additions & 0 deletions test/level2/html.js
Expand Up @@ -19796,5 +19796,16 @@ exports.tests = {

delete String.prototype.normalize;
test.done();
},

filename_with_spaces_in_script_tag_can_be_read: function(test) {
jsdom.env(
'<html><head></head><body></body></html>',
['./html/files/js/script with spaces.js'],
function(err, window){
test.strictEqual(err, null, "There should be no errors when using scripts with spaces in their filenames");
test.done();
}
);
}
}
Empty file.

0 comments on commit 40f0eb5

Please sign in to comment.