Skip to content

Commit

Permalink
Use latest urlmaster with proper testing for valid location URLs. Upd…
Browse files Browse the repository at this point in the history
…ate url_resolution() tests automated to use better urlmaster.
  • Loading branch information
deitch committed Jan 21, 2013
1 parent c965da0 commit 729c90e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -198,7 +198,7 @@
"console.log" : "*",
"html5" : ">=0.3.8",
"optimist" : "*",
"urlmaster" : ">=0.2.x"
"urlmaster" : ">=0.2.5"
},
"directories": {
"lib": "./lib/jsdom"
Expand Down
11 changes: 7 additions & 4 deletions test/jsdom/index.js
Expand Up @@ -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.

Copy link
@domenic

domenic Jan 25, 2013

For Windows compat, this should be locn = toFileUrl(__filename)

This comment has been minimized.

Copy link
@deitch

deitch Jan 26, 2013

Author Owner

Agreed. I just pushed the change in. Makes it a lot easier and cleaner.


// 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);
});
});
}
Expand Down

0 comments on commit 729c90e

Please sign in to comment.