@@ -43,10 +43,10 @@ const accessorTests = [{
4343} , {
4444 // Setting href to non-null non-string coerces to string
4545 url : 'google' ,
46- set : { href : undefined } ,
46+ set : { href : 0 } ,
4747 test : {
48- path : 'undefined ' ,
49- href : 'undefined '
48+ path : '0 ' ,
49+ href : '0 '
5050 }
5151} , {
5252 // Setting port is reflected in host
@@ -180,8 +180,8 @@ const accessorTests = [{
180180 url : 'http://www.google.com' ,
181181 set : { search : '' } ,
182182 test : {
183- search : '?' ,
184- path : '/? '
183+ search : null ,
184+ path : '/'
185185 }
186186} , {
187187
@@ -203,10 +203,11 @@ const accessorTests = [{
203203} , {
204204
205205 // Empty hash is ok
206- url : 'http://www.google.com' ,
206+ url : 'http://www.google.com#hash ' ,
207207 set : { hash : '' } ,
208208 test : {
209- hash : '#'
209+ hash : null ,
210+ href : 'http://www.google.com/'
210211 }
211212} , {
212213
@@ -252,7 +253,8 @@ const accessorTests = [{
252253 url : 'http://www.google.com' ,
253254 set : { pathname : '' } ,
254255 test : {
255- pathname : '/'
256+ pathname : null ,
257+ href : 'http://www.google.com'
256258 }
257259} , {
258260 // Null path is ok
@@ -290,11 +292,12 @@ const accessorTests = [{
290292 protocol : null
291293 }
292294} , {
293- // Empty protocol is invalid
295+ // Empty protocol is ok
294296 url : 'http://www.google.com/path' ,
295297 set : { protocol : '' } ,
296298 test : {
297- protocol : 'http:'
299+ protocol : null ,
300+ href : '//www.google.com/path'
298301 }
299302} , {
300303 // Set query to an object
@@ -327,9 +330,9 @@ const accessorTests = [{
327330 url : 'http://www.google.com/path?key=value' ,
328331 set : { path : '?key2=value2' } ,
329332 test : {
330- pathname : '/' ,
333+ pathname : null ,
331334 search : '?key2=value2' ,
332- href : 'http://www.google.com/ ?key2=value2'
335+ href : 'http://www.google.com?key2=value2'
333336 }
334337} , {
335338 // path is reflected in search and pathname 3
@@ -349,6 +352,38 @@ const accessorTests = [{
349352 search : null ,
350353 href : 'http://www.google.com'
351354 }
355+ } , {
356+ // setting hash to '' removes any hash
357+ url : 'http://www.google.com/#hash' ,
358+ set : { hash : '' } ,
359+ test : {
360+ hash : null ,
361+ href : 'http://www.google.com/'
362+ }
363+ } , {
364+ // setting hash to '#' removes any hash
365+ url : 'http://www.google.com/#hash' ,
366+ set : { hash : '#' } ,
367+ test : {
368+ hash : null ,
369+ href : 'http://www.google.com/'
370+ }
371+ } , {
372+ // setting search to '' removes any search
373+ url : 'http://www.google.com/?search' ,
374+ set : { search : '' } ,
375+ test : {
376+ search : null ,
377+ href : 'http://www.google.com/'
378+ }
379+ } , {
380+ // setting search to '?' removes any search
381+ url : 'http://www.google.com/?search' ,
382+ set : { search : '?' } ,
383+ test : {
384+ search : null ,
385+ href : 'http://www.google.com/'
386+ }
352387}
353388
354389] ;
0 commit comments