|
@ -1113,7 +1113,7 @@ var formatTests = { |
|
|
|
|
|
|
|
|
// `#`,`?` in path
|
|
|
// `#`,`?` in path
|
|
|
'/path/to/%%23%3F+=&.txt?foo=theA1#bar' : { |
|
|
'/path/to/%%23%3F+=&.txt?foo=theA1#bar' : { |
|
|
href: '/path/to/%%23%3F+=&.txt?foo=theA1#bar', |
|
|
href : '/path/to/%%23%3F+=&.txt?foo=theA1#bar', |
|
|
pathname: '/path/to/%#?+=&.txt', |
|
|
pathname: '/path/to/%#?+=&.txt', |
|
|
query: { |
|
|
query: { |
|
|
foo: 'theA1' |
|
|
foo: 'theA1' |
|
@ -1123,7 +1123,7 @@ var formatTests = { |
|
|
|
|
|
|
|
|
// `#`,`?` in path + `#` in query
|
|
|
// `#`,`?` in path + `#` in query
|
|
|
'/path/to/%%23%3F+=&.txt?foo=the%231#bar' : { |
|
|
'/path/to/%%23%3F+=&.txt?foo=the%231#bar' : { |
|
|
href: '/path/to/%%23%3F+=&.txt?foo=the%231#bar', |
|
|
href : '/path/to/%%23%3F+=&.txt?foo=the%231#bar', |
|
|
pathname: '/path/to/%#?+=&.txt', |
|
|
pathname: '/path/to/%#?+=&.txt', |
|
|
query: { |
|
|
query: { |
|
|
foo: 'the#1' |
|
|
foo: 'the#1' |
|
@ -1138,7 +1138,7 @@ var formatTests = { |
|
|
hostname: 'ex.com', |
|
|
hostname: 'ex.com', |
|
|
hash: '#frag', |
|
|
hash: '#frag', |
|
|
search: '?abc=the#1?&foo=bar', |
|
|
search: '?abc=the#1?&foo=bar', |
|
|
pathname: '/foo?100%m#r' |
|
|
pathname: '/foo?100%m#r', |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// `?` and `#` in search only
|
|
|
// `?` and `#` in search only
|
|
@ -1148,77 +1148,8 @@ var formatTests = { |
|
|
hostname: 'ex.com', |
|
|
hostname: 'ex.com', |
|
|
hash: '#frag', |
|
|
hash: '#frag', |
|
|
search: '?abc=the#1?&foo=bar', |
|
|
search: '?abc=the#1?&foo=bar', |
|
|
pathname: '/fooA100%mBr' |
|
|
pathname: '/fooA100%mBr', |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// path
|
|
|
|
|
|
'http://github.com/joyent/node#js1': { |
|
|
|
|
|
href: 'http://github.com/joyent/node#js1', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js1', |
|
|
|
|
|
path: '/joyent/node' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// pathname vs. path, path wins
|
|
|
|
|
|
'http://github.com/joyent/node2#js1': { |
|
|
|
|
|
href: 'http://github.com/joyent/node2#js1', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js1', |
|
|
|
|
|
path: '/joyent/node2', |
|
|
|
|
|
pathname: '/joyent/node' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// pathname with query/search
|
|
|
|
|
|
'http://github.com/joyent/node?foo=bar#js2': { |
|
|
|
|
|
href: 'http://github.com/joyent/node?foo=bar#js2', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js2', |
|
|
|
|
|
path: '/joyent/node?foo=bar' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// path vs. query, path wins
|
|
|
|
|
|
'http://github.com/joyent/node?foo=bar2#js3': { |
|
|
|
|
|
href: 'http://github.com/joyent/node?foo=bar2#js3', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js3', |
|
|
|
|
|
path: '/joyent/node?foo=bar2', |
|
|
|
|
|
query: {foo: 'bar'} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// path vs. search, path wins
|
|
|
|
|
|
'http://github.com/joyent/node?foo=bar3#js4': { |
|
|
|
|
|
href: 'http://github.com/joyent/node?foo=bar3#js4', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js4', |
|
|
|
|
|
path: '/joyent/node?foo=bar3', |
|
|
|
|
|
search: '?foo=bar' |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// path is present without ? vs. query given
|
|
|
|
|
|
'http://github.com/joyent/node#js5': { |
|
|
|
|
|
href: 'http://github.com/joyent/node#js5', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js5', |
|
|
|
|
|
path: '/joyent/node', |
|
|
|
|
|
query: {foo: 'bar'} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// path is present without ? vs. search given
|
|
|
|
|
|
'http://github.com/joyent/node#js6': { |
|
|
|
|
|
href: 'http://github.com/joyent/node#js6', |
|
|
|
|
|
protocol: 'http:', |
|
|
|
|
|
hostname: 'github.com', |
|
|
|
|
|
hash: '#js6', |
|
|
|
|
|
path: '/joyent/node', |
|
|
|
|
|
search: '?foo=bar' |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
for (var u in formatTests) { |
|
|
for (var u in formatTests) { |
|
|
var expect = formatTests[u].href; |
|
|
var expect = formatTests[u].href; |
|
|