File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 6464 testing . expectEqual ( null , url . searchParams . get ( 'a' ) ) ;
6565</ script >
6666
67+ < script id =searchParamsSetHref >
68+ url = new URL ( "https://foo.bar" ) ;
69+ const searchParams = url . searchParams ;
70+
71+ // SearchParams should be empty.
72+ testing . expectEqual ( 0 , searchParams . size ) ;
73+
74+ url . href = "https://lightpanda.io?over=9000&light=panda" ;
75+ // It won't hurt to check href and host too.
76+ testing . expectEqual ( "https://lightpanda.io/?over=9000&light=panda" , url . href ) ;
77+ testing . expectEqual ( "lightpanda.io" , url . host ) ;
78+ // SearchParams should be updated too when URL is set.
79+ testing . expectEqual ( 2 , searchParams . size ) ;
80+ testing . expectEqual ( "9000" , searchParams . get ( "over" ) ) ;
81+ testing . expectEqual ( "panda" , searchParams . get ( "light" ) ) ;
82+ </ script >
83+
6784< script id =base >
6885 url = new URL ( 'over?9000' , 'https://lightpanda.io' ) ;
6986 testing . expectEqual ( "https://lightpanda.io/over?9000" , url . href ) ;
You can’t perform that action at this time.
0 commit comments