forked from jsdom/jsdom
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use latest urlmaster with proper testing for valid location URLs. Upd…
…ate url_resolution() tests automated to use better urlmaster.
- Loading branch information
Showing
2 changed files
with
8 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -719,19 +719,22 @@ exports.tests = { | |
// build html with every possible link | ||
var html = '\ | ||
<html>\ | ||
<head></head>\ | ||
<head><base href=""></base></head>\ | ||
<body>'; | ||
refs.forEach(function(ref,i){ | ||
html += '<a href="'+ref+'" id="link'+i+'">link'+i+'</a>\n'; | ||
}); | ||
html += "</body></html>"; | ||
var locn = locn = "file://"+__filename; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
deitch
Author
Owner
|
||
|
||
// now check each base case | ||
bases.forEach(function(base,i){ | ||
var doc = jsdom.jsdom(html, null, {url: base}), expected = um.resolveTrack(base,refs); | ||
var doc = jsdom.jsdom(html, null, {url: locn}), expected = um.resolveTrack(locn,base,refs); | ||
// set up the base | ||
doc.getElementsByTagName("base")[0].setAttribute("href",base); | ||
refs.forEach(function(ref,j){ | ||
var result = expected[j][2]; | ||
test.equal(doc.getElementById("link"+j).href, result, 'base '+base+' with ref '+ref+' should resolve to '+result); | ||
var result = expected[j][3]; | ||
test.equal(doc.getElementById("link"+j).href, result, 'locn '+locn+' base '+base+' with ref '+ref+' should resolve to '+result+' instead of '+doc.getElementById("link"+j).href); | ||
}); | ||
}); | ||
} | ||
|
For Windows compat, this should be
locn = toFileUrl(__filename)