@@ -527,14 +527,39 @@ describe('$location', function() {
527
527
it ( 'should preserve query params in base' , function ( ) {
528
528
var locationUrl = new LocationHashbangUrl ( 'http://www.server.org:1234/base?base=param' , 'http://www.server.org:1234/' , '#' ) ;
529
529
locationUrl . $$parse ( 'http://www.server.org:1234/base?base=param#/path?a=b&c#hash' ) ;
530
- expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/path?a=b&c#hash' ) ;
530
+ expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/path?base=param& a=b&c#hash' ) ;
531
531
532
+ expect ( locationUrl . search ( ) ) . toEqual ( { base : 'param' , a : 'b' , c : true } ) ;
532
533
locationUrl . path ( '/new/path' ) ;
533
534
locationUrl . search ( { one : 1 } ) ;
534
535
locationUrl . hash ( 'hhh' ) ;
535
536
expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/new/path?one=1#hhh' ) ;
536
537
} ) ;
537
538
539
+ it ( 'should copy query params to fragment' , function ( ) {
540
+ var locationUrl = new LocationHashbangUrl ( 'http://www.server.org:1234/base?base=param' , 'http://www.server.org:1234/' , '#' ) ;
541
+ locationUrl . $$parse ( 'http://www.server.org:1234/base?base=param#/path' ) ;
542
+
543
+ expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/path?base=param' ) ;
544
+
545
+ expect ( locationUrl . search ( ) ) . toEqual ( { base : 'param' } ) ;
546
+ locationUrl . path ( '/new/path' ) ;
547
+ locationUrl . search ( { one : 1 } ) ;
548
+ locationUrl . hash ( 'hhh' ) ;
549
+ expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/new/path?one=1#hhh' ) ;
550
+
551
+ locationUrl . $$parse ( 'http://www.server.org:1234/base?base=param#/path#trailingHash' ) ;
552
+
553
+ expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/path?base=param#trailingHash' ) ;
554
+
555
+ expect ( locationUrl . search ( ) ) . toEqual ( { base : 'param' } ) ;
556
+ locationUrl . path ( '/new/path' ) ;
557
+ locationUrl . search ( { one : 1 } ) ;
558
+ locationUrl . hash ( 'hhh' ) ;
559
+ expect ( locationUrl . absUrl ( ) ) . toBe ( 'http://www.server.org:1234/base?base=param#/new/path?one=1#hhh' ) ;
560
+
561
+ } ) ;
562
+
538
563
539
564
it ( 'should prefix path with forward-slash' , function ( ) {
540
565
var locationUrl = new LocationHashbangUrl ( 'http://host.com/base' , 'http://host.com/' , '#' ) ;
0 commit comments